예제 #1
0
 def test_partial_sink_consumption(self):
     source = {'remaining': 50}
     sink = {'remaining': 100}
     self.assertEqual(consume(source, sink), ({
         'remaining': 0
     }, {
         'remaining': 50
     }, 50))
예제 #2
0
 def test_zero_source_consumption(self):
     source = {'remaining': 0}
     sink = {'remaining': 100}
     self.assertEqual(consume(source, sink), ({
         'remaining': 0
     }, {
         'remaining': 100
     }, 0))
예제 #3
0
 def test_partial_sink_consumption_with_efficiency(self):
     source = {'remaining': 50}
     sink = {'remaining': 100}
     self.assertEqual(consume(source, sink, efficiency=0.6),
                      ({
                          'remaining': 0
                      }, {
                          'remaining': 70
                      }, 30))
예제 #4
0
 def test_full_consumption_with_efficiency(self):
     source = {'remaining': 100}
     sink = {'remaining': 100}
     self.assertEqual(consume(source, sink, efficiency=0.6),
                      ({
                          'remaining': 0
                      }, {
                          'remaining': 40
                      }, 60))