Ad
  • Default User Avatar

    me too. Did you ever figure it our?

  • Custom User Avatar

    Test.assertDeepEquals

  • Default User Avatar

    The remainder should always have the same sign as the number you're dividing. a divided by b equals c with a remainder of d (a = b * c + d).

    Try running these tests:

    Test.assertEquals(remainder(5, 3), 2, "5 divided by 3 equals 1 with a remainder of 2 (5 = 3 * 1 + 2)");
    Test.assertEquals(remainder(5, -3), 2, "5 divided by -3 equals -1 with a remainder of 2 (5 = -3 * -1 + 2)");
    /* note: you can't run the next 2 tests since it always divides the larger number by the smaller. Otherwise, these would also work:
    Test.assertEquals(remainder(-5, 3), -2, "-5 divided by 3 equals -1 with a remainder of -2 (-5 = 3 * -1 + -2)");
    Test.assertEquals(remainder(-5, -3), -2, "-5 divided by -3 equals 1 with a remainder of -2 (-5 = -3 * 1 + -2)");
    */