Exemple #1
0
 def test_cash_money_penny(self):
     """Test a penny."""
     argument = 0.01
     expected = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1]
     lab04.cash_money(0.01)
     self.assertEqual(expected, lab04.cash_money(argument),
                      "The number is a penny.")
Exemple #2
0
 def test_cash_money_one_hundred_bill(self):
     """Test a one hundred dollar bill."""
     argument = 100.00
     expected = [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
     lab04.cash_money(argument)
     self.assertEqual(expected, lab04.cash_money(argument),
                      "The number is a one hundred dollar bill.")
Exemple #3
0
 def test_cash_money_nickle(self):
     """Test a nickle."""
     argument = 0.05
     expected = [0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0]
     lab04.cash_money(argument)
     self.assertEqual(expected, lab04.cash_money(argument),
                      "The number is a nickle.")
Exemple #4
0
 def test_cash_money_two_pennies(self):
     """Test the two pennies."""
     argument = 0.02
     expected = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2]
     lab04.cash_money(argument)
     self.assertEqual(expected, lab04.cash_money(argument),
                      "The number is two pennies.")
Exemple #5
0
 def test_cash_money_quarter(self):
     """Test a quarter."""
     argument = 0.25
     expected = [0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0]
     lab04.cash_money(argument)
     self.assertEqual(expected, lab04.cash_money(argument),
                      "The number is a quarter.")
Exemple #6
0
 def test_cash_money_dime(self):
     """Test a dime."""
     argument = 0.10
     expected = [0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0]
     lab04.cash_money(argument)
     self.assertEqual(expected, lab04.cash_money(argument),
                      "The number is a dime.")
Exemple #7
0
 def test_cash_money_zero(self):
     """Test the value 0.00."""
     argument = 0.00
     expected = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
     lab04.cash_money(argument)
     self.assertEqual(expected, lab04.cash_money(argument),
                      "The number is zero")
Exemple #8
0
 def test_cash_money_loonie_and_dime(self):
     """Test a loonie and a dime."""
     argument = 1.05
     expected = [0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0]
     lab04.cash_money(argument)
     self.assertEqual(expected, lab04.cash_money(argument),
                      "The number is a loonie and a dime.")
Exemple #9
0
 def test_cash_money_toonie(self):
     """Test a loonie."""
     argument = 2.00
     expected = [0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0]
     lab04.cash_money(argument)
     self.assertEqual(expected, lab04.cash_money(argument),
                      "The number is toonie.")
Exemple #10
0
 def test_cash_money_ten_bill(self):
     """Test a ten dollar bill."""
     argument = 10.00
     expected = [0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0]
     lab04.cash_money(argument)
     self.assertEqual(expected, lab04.cash_money(argument),
                      "The number is a ten dollar bill.")
Exemple #11
0
 def test_cash_money_fin(self):
     """Test a fin."""
     argument = 5.00
     expected = [0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0]
     lab04.cash_money(argument)
     self.assertEqual(expected, lab04.cash_money(argument),
                      "The number is a fin.")
Exemple #12
0
 def test_cash_money_three_denominations(self):
     """Test a ten dollar bill and twenty-seven cents, which are three denominations."""
     argument = 10.27
     expected = [0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 2]
     lab04.cash_money(argument)
     self.assertEqual(
         expected, lab04.cash_money(argument),
         "The number is a ten dollar bill and twenty-seven cents,"
         "which are three denominations.")
Exemple #13
0
 def test_cash_money_bill_and_coin_mix(self):
     """Test a one hundred dollar bill and fifty seven cents,
         which is a mixture of coins and bill"""
     argument = 100.57
     expected = [1, 0, 0, 0, 0, 0, 0, 2, 0, 1, 2]
     lab04.cash_money(argument)
     self.assertEqual(
         expected, lab04.cash_money(argument),
         "The number is one hundred dollar bill and fifty seven cents, "
         "which is a mixture of coins and bill.")
Exemple #14
0
 def test_cash_money_all_denominations(self):
     """Test the one hundred eighty eight dollar bills and forty one cents,
         which contains all the denominations."""
     argument = 188.41
     expected = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
     lab04.cash_money(argument)
     self.assertEqual(
         expected, lab04.cash_money(argument),
         "The number is a one hundred eighty eight dollar bills and forty one cents,"
         "which contains all the denominations.")
 def test_cash_money_ten_dollars_twenty_seven_cents(self):
     """Test cash_money for ten dollars."""
     argument = lab04.cash_money(10.27)
     expected = [0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 2]
     self.assertEqual(
         expected, argument,
         "The tens element and the pennies and quarter are non-zero")
 def test_cash_money_two_cents(self):
     """Test cash_money for two pennies."""
     argument = lab04.cash_money(0.02)
     expected = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2]
     self.assertEqual(
         expected, argument,
         "The pennies element is 2 and the rest are all zeroes")
 def test_cash_money_one_dollar_five_cents(self):
     """Test cash_money for one dollar and five cents."""
     argument = lab04.cash_money(1.05)
     expected = [0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0]
     self.assertEqual(
         expected, argument,
         "The loonie element and the nickel element are the non-zero elements"
     )
 def test_cash_money_hundred_dollars_fifty_seven_cents(self):
     """Test cash_money with a hundred dollars and fifty seven cents."""
     argument = lab04.cash_money(100.57)
     expected = [1, 0, 0, 0, 0, 0, 0, 2, 0, 1, 2]
     self.assertEqual(expected, argument,
                      "A variety of elements are non-zeroes")
 def test_cash_money_big_number(self):
     """Test cash_money with a large parameter input."""
     argument = lab04.cash_money(1000000)
     expected = [10000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
     self.assertEqual(expected, argument,
                      "The list has a large first element")
 def test_cash_money_one_cent(self):
     """Test cash_money for one penny."""
     argument = lab04.cash_money(0.01)
     expected = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1]
     self.assertEqual(expected, argument,
                      "The pennies element is the only non-zero element")
 def test_cash_money_nickel(self):
     """Test cash_money for one nickel."""
     argument = lab04.cash_money(0.05)
     expected = [0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0]
     self.assertEqual(expected, argument,
                      "The nickel element is the only non-zero element")
 def test_cash_money_dime(self):
     """Test cash_money for one dime."""
     argument = lab04.cash_money(0.10)
     expected = [0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0]
     self.assertEqual(expected, argument,
                      "The dimes element is the only non-zero element")
 def test_cash_money_quarter(self):
     """Test cash_money for one quarter."""
     argument = lab04.cash_money(0.25)
     expected = [0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0]
     self.assertEqual(expected, argument,
                      "The quarter element is the only non-zero element")
 def test_cash_money_one_dollar(self):
     """Test cash_money for one dollar."""
     argument = lab04.cash_money(1.00)
     expected = [0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0]
     self.assertEqual(expected, argument,
                      "The loonie element is the only non-zero element")
 def test_cash_money_all_numbers(self):
     """Test cash_money where every list is non-zero."""
     argument = lab04.cash_money(188.93)
     expected = [1, 1, 1, 1, 1, 1, 1, 3, 1, 1, 3]
     self.assertEqual(expected, argument, "The list is all non-zeroes")
 def test_cash_money_zero(self):
     """Test cash_money for value 0."""
     argument = lab04.cash_money(0.00)
     expected = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
     self.assertEqual(expected, argument, "The list is all zeroes")
 def test_cash_money_five_dollars(self):
     """Test cash_money for five dollars."""
     argument = lab04.cash_money(5.00)
     expected = [0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0]
     self.assertEqual(expected, argument,
                      "The fives element is the only non-zero element")
 def test_cash_money_twenty_dollars(self):
     """Test cash_money for twenty dollars."""
     argument = lab04.cash_money(20.00)
     expected = [0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0]
     self.assertEqual(expected, argument,
                      "The twenties element is the only non-zero element")
 def test_cash_money_one_hundred(self):
     """Test cash_money for one hundred dollars."""
     argument = lab04.cash_money(100.00)
     expected = [1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
     self.assertEqual(expected, argument,
                      "The hundreds element is the only non-zero element")