def test_change( self ): self.assertEqual( ( 3, 2, 0, 2 ), change( 97 ) ) self.assertEqual( ( 0, 0, 1, 3 ), change( 8 ) ) self.assertEqual( ( 10, 0, 0, 0 ), change( 250 ) ) self.assertEqual( ( 0, 0, 0, 0 ), change( 0 ) ) self.assertEqual( ( 0, 0, 0, 1 ), change( 1 ) ) self.assertEqual( ( 0, 0, 1, 0 ), change( 5 ) ) self.assertEqual( ( 0, 1, 0, 0 ), change( 10 ) ) self.assertEqual( ( 1, 0, 0, 0 ), change( 25 ) ) self.assertEqual( ( 39, 2, 0, 4 ), change( 999 ) ) self.assertEqual( ( 402, 1, 1, 3 ), change( 10068 ) )
def test_change(self): self.assertEqual((3, 2, 0, 2), change(97)) self.assertEqual((0, 0, 1, 3), change(8)) self.assertEqual((10, 0, 0, 0), change(250)) self.assertEqual((0, 0, 0, 0), change(0)) self.assertEqual((0, 0, 0, 1), change(1)) self.assertEqual((0, 0, 1, 0), change(5)) self.assertEqual((0, 1, 0, 0), change(10)) self.assertEqual((1, 0, 0, 0), change(25)) self.assertEqual((39, 2, 0, 4), change(999)) self.assertEqual((402, 1, 1, 3), change(10068))
def test_change(self): self.assertEqual((3, 2, 0, 2), change(97)) self.assertEqual((1, 0, 1, 0), change(30)) self.assertEqual((0, 0, 1, 3), change(8)) self.assertEqual((5, 1, 0, 2), change(137)) self.assertEqual((4, 0, 0, 0), change(100)) self.assertEqual((0, 0, 0, 0), change(0)) self.assertEqual((160103, 2, 0, 2), change(4002597)) self.assertEqual((0, 0, 0, 4), change(4)) with self.assertRaises(ValueError): change(-20)
def test_change(self): self.assertEqual((3, 2, 0, 2), change(97)) self.assertEqual((0, 0, 1, 3), change(8)) self.assertEqual((10, 0, 0, 0), change(250)) # Fractions of cents should cause the change function to round down and then perform the calculation self.assertEqual((0, 1, 0, 2), change(12.75)) # Check for 0 self.assertEqual((0, 0, 0, 0), change(0)) # Really big number that should obviously only come out to having 4^20 quarters self.assertEqual((400000000000000000000, 0, 0, 0), change(10000000000000000000000))
def test_change(self): self.assertEqual((3, 2, 0, 2), change(97)) self.assertEqual((0, 0, 1, 3), change(8)) self.assertEqual((56514938, 0, 1, 1), change(1412873456)) self.assertEqual((1, 1, 1, 1), change(41)) self.assertEqual((35, 1, 1, 0), change(890)) self.assertEqual((0, 0, 0, 4), change(4)) self.assertEqual((4938271, 1, 0, 4), change(123456789)) self.assertEqual((10, 0, 0, 0), change(250)) self.assertEqual((20, 1, 1, 4), change(519)) self.assertEqual((44, 1, 0, 1), change(1111)) with self.assertRaises(ValueError): change(-2) change(-30000)