package Ġde . h ud de ld ad del . euler . math Ċ Ċ import Ġde . h ud de ld ad del . euler . math . Fraction . Companion . compute G reatest Common Div isor Ċ import Ġde . h ud de ld ad del . euler . math . Fraction . Companion . compute Least Common Multiple Ċ import Ġorg . junit . jupiter . api . Assertions . assertEquals Ċ import Ġorg . junit . jupiter . api . Test Ċ import Ġjava . math . BigInteger Ċ import Ġjava . math . BigInteger . valueOf Ċ Ċ class ĠFraction Test Ġ{ ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġtest Compute G reatest Common Div isor () Ġ{ ĊĠĠĠĠĠĠĠ ĠassertEquals ( valueOf ( 4 L ), Ġcompute G reatest Common Div isor ( valueOf ( 1 2 L ), Ġvalue Of ( 4 4 L ))) ĊĠĠĠĠĠĠĠ ĠassertEquals ( valueOf ( 4 L ), Ġcompute G reatest Common Div isor ( valueOf (- 1 2 ), Ġvalue Of ( 4 4 ))) ĊĠĠĠĠĠĠĠ ĠassertEquals ( valueOf ( 4 L ), Ġcompute G reatest Common Div isor ( valueOf ( 1 2 ), Ġvalue Of (- 4 4 ))) ĊĠĠĠĠĠĠĠ ĠassertEquals ( valueOf ( 4 L ), Ġcompute G reatest Common Div isor ( valueOf (- 1 2 ), Ġvalue Of (- 4 4 ))) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġtest Compute Least Common Multiple () Ġ{ ĊĠĠĠĠĠĠĠ ĠassertEquals ( valueOf ( 5 2 9 2 0 L ), Ġcompute Least Common Multiple ( valueOf ( 3 5 2 8 L ), Ġvalue Of ( 3 7 8 0 L ))) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġtest Extend () Ġ{ ĊĠĠĠĠĠĠĠ ĠassertEquals ( Fraction ( valueOf ( 2 L ), Ġvalue Of ( 4 L )), ĠFraction ( valueOf ( 1 L ), Ġvalue Of ( 2 L )). extend ( valueOf ( 4 L ))) ĊĠĠĠĠĠĠĠ ĠassertEquals ( Fraction ( valueOf ( 4 L ), Ġvalue Of ( 8 L )), ĠFraction ( valueOf ( 1 L ), Ġvalue Of ( 2 L )). extend ( valueOf ( 8 L ))) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġtest Plus () Ġ{ ĊĠĠĠĠĠĠĠ Ġval Ġhalf Ġ= ĠFraction ( valueOf ( 1 L ), Ġvalue Of ( 2 L )) ĊĠĠĠĠĠĠĠ Ġval Ġquarter Ġ= ĠFraction ( valueOf ( 1 L ), Ġvalue Of ( 4 L )) ĊĠĠĠĠĠĠĠ ĠassertEquals ( Fraction ( valueOf ( 3 L ), Ġvalue Of ( 4 L )), Ġ( half Ġ+ Ġquarter )) ĊĠĠĠĠĠĠĠ ĠassertEquals ( Fraction ( valueOf ( 3 L ), Ġvalue Of ( 4 L )), Ġ( quarter Ġ+ Ġhalf )) ĊĠĠĠ Ġ} ĊĊĠĠĠ Ġ@ Test ĊĠĠĠ Ġfun Ġtest Times () Ġ{ ĊĠĠĠĠĠĠĠ ĠassertEquals ( Fraction ( valueOf ( 3 L ), Ġvalue Of ( 7 L )), ĠFraction ( valueOf ( 2 L ), Ġvalue Of ( 3 L )) Ġ* ĠFraction ( valueOf ( 9 L ), Ġvalue Of ( 1 4 L ))) ĊĠĠĠ Ġ} Ċ Ċ }