Ad
  • Custom User Avatar

    poor tests

  • Custom User Avatar

    Keep the values to 2 decimal places.

    How to keep 2 decimal places? round, floor, or ceil?

    I used ceil, because in testcase1:

    splitTheBill(100, 2, 1), '45.45,54.54'
    

    I got two decimal numbers:

    45.45454545454545 54.54545454545454
    

    But I failed at testcase3:

    Test.assertEquals(splitTheBill(59, 4, 1), '14.05,16.86');
    

    I got two decimal numbers:

    14.047619047619047 16.857142857142858
    
    Expected: '14.05,16.86', instead got: '14.04,16.85'