示例#1
0
 def test_item_c_available(self):
     m = Machine()
     m.run('CHECK-C')
     self.assertEqual(m.c_items, 15)
示例#2
0
 def test_buy_item_b(self):
     m = Machine()
     m.run('Q', 'Q', 'D', 'D', 'D', 'D', 'N', 'N')
     m.run('BUY-B')
     self.assertEqual(m.b_items, 4)
示例#3
0
 def test_item_b_available(self):
     m = Machine()
     m.run('CHECK-B')
     self.assertEqual(m.b_items, 5)
示例#4
0
 def test_item_a_available(self):
     m = Machine()
     m.run('CHECK-A')
     self.assertEqual(m.a_items, 10)
示例#5
0
 def test_item_buy_4(self):
     m = Machine()
     m.run('Q', 'Q', 'D', 'D', 'D', 'D', 'N', 'N')
     m.run('BUY-B')
     self.assertEqual(m.response, ['B'])
示例#6
0
 def test_not_enough_money(self):
     m = Machine()
     m.run('Q', 'Q')
     m.run('BUY-B')
     self.assertEqual(m.response, ['Not enough money'])
示例#7
0
 def test_item_buy_2(self):
     m = Machine()
     m.run('Q', 'Q', 'Q', 'Q', 'Q', 'Q')
     m.run('BUY-C')
     self.assertEqual(m.response, ['C'])
示例#8
0
 def test_cheat(self):
     m = Machine()
     m.run('Q')
     m.run('COIN-RETURN')
     m.run('COIN-RETURN')
     self.assertEqual(m.response, ['Q'])
示例#9
0
 def test_coin_insert_3(self):
     m = Machine()
     m.run('Q', 'N', 'D')
     m.run('COIN-RETURN')
     self.assertEqual(m.response, ['Q', 'N', 'D'])
示例#10
0
 def test_coin_sum_2(self):
     m = Machine()
     m.run('D', 'N', 'Q', 'Q', 'N')
     self.assertEqual(m.get_current_sum(), 0.7)
示例#11
0
 def test_empty_coin_return(self):
     m = Machine()
     m.run('COIN-RETURN')
     self.assertEqual(m.response, [])