@@ -8,3 +8,65 @@ const isProperFraction = require("../implement/2-is-proper-fraction");
88test ( `should return false when denominator is zero` , ( ) => {
99 expect ( isProperFraction ( 1 , 0 ) ) . toEqual ( false ) ;
1010} ) ;
11+
12+ test ( "should return true when numerator is zero and denominator is non-zero" , ( ) => {
13+ expect ( isProperFraction ( 0 , 5 ) ) . toEqual ( true ) ;
14+ } ) ;
15+
16+ test ( "should return false when both numerator and denominator are zero" , ( ) => {
17+ expect ( isProperFraction ( 0 , 0 ) ) . toEqual ( false ) ;
18+ } ) ;
19+
20+ // Special case: Identify proper Fractions:
21+ test ( "should return true for proper fraction" , ( ) => {
22+ expect ( isProperFraction ( 2 , 3 ) ) . toEqual ( true ) ;
23+ } ) ;
24+
25+ // Special case: Identify Negative Fractions:
26+ test ( "should return true for proper negative fraction" , ( ) => {
27+ expect ( isProperFraction ( - 3 , 6 ) ) . toEqual ( true ) ;
28+ } ) ;
29+
30+ test ( "should return false for improper negative fraction" , ( ) => {
31+ expect ( isProperFraction ( - 5 , 2 ) ) . toEqual ( false ) ;
32+ } ) ;
33+
34+ test ( "should return true for proper fraction with negative denominator" , ( ) => {
35+ expect ( isProperFraction ( 2 , - 5 ) ) . toEqual ( true ) ;
36+ } ) ;
37+
38+ test ( "should return false for improper fraction with negative denominator" , ( ) => {
39+ expect ( isProperFraction ( 7 , - 3 ) ) . toEqual ( false ) ;
40+ } ) ;
41+
42+ // Special case: Identify Equal Numerator and Denominator:
43+ test ( "should return false for improper fraction (numerator === denominator)" , ( ) => {
44+ expect ( isProperFraction ( 3 , 3 ) ) . toEqual ( false ) ;
45+ } ) ;
46+
47+ // Special case: Identify both Numerator and Denominator as negative
48+ test ( "should return true when both numerator and denominator are negative and proper" , ( ) => {
49+ expect ( isProperFraction ( - 2 , - 5 ) ) . toEqual ( true ) ;
50+ } ) ;
51+
52+ test ( "should return false when both numerator and denominator are negative and improper" , ( ) => {
53+ expect ( isProperFraction ( - 6 , - 3 ) ) . toEqual ( false ) ;
54+ } ) ;
55+
56+ // Special case: Identify both Numerator and Denominator as decimal
57+ test ( "should return true for proper decimal fractions" , ( ) => {
58+ expect ( isProperFraction ( 1.5 , 2.5 ) ) . toEqual ( true ) ;
59+ } ) ;
60+
61+ test ( "should return false for improper decimal fractions" , ( ) => {
62+ expect ( isProperFraction ( 2.5 , 1.5 ) ) . toEqual ( false ) ;
63+ } ) ;
64+
65+ // Special case: Identify both Numerator and Denominator as large numbers
66+ test ( "should return true for large proper fractions" , ( ) => {
67+ expect ( isProperFraction ( 100 , 1000 ) ) . toEqual ( true ) ;
68+ } ) ;
69+
70+ test ( "should return false for large improper fractions" , ( ) => {
71+ expect ( isProperFraction ( 1000 , 100 ) ) . toEqual ( false ) ;
72+ } ) ;
0 commit comments