Esempio n. 1
0
 def test_achieve(self):
     current = ['hand empty', 'arm down']
     goal = 'baseball in air'
     expected = [
         'arm down', 'baseball in air', 'grabbing baseball', 'raising arm',
         'throwing baseball'
     ]
     final = gps.achieve(current, ops, goal, [])
     self.assertEqual(set(expected), set(final))
Esempio n. 2
0
 def test_achieve(self):
     current = ['hand empty', 'arm down']
     goal = 'baseball in air'
     expected = ['arm down',
                 'baseball in air',
                 'grabbing baseball',
                 'raising arm',
                 'throwing baseball']
     final = gps.achieve(current, ops, goal, [])
     self.assertEqual(set(expected), set(final))
Esempio n. 3
0
 def test_achieve_try_another_op(self):
     current = ['hand empty', 'arm down']
     levitate_baseball = {'action': 'levitate baseball',
                          'preconds': ['magic'],
                          'add': ['baseball in air'],
                          'delete': []}
     goal = 'baseball in air'
     new_ops = [levitate_baseball] + ops
     final = gps.achieve(current, new_ops, goal, [])
     expected = ['arm down',
                 'baseball in air',
                 'grabbing baseball',
                 'raising arm',
                 'throwing baseball']
     self.assertEqual(set(expected), set(final))
Esempio n. 4
0
 def test_achieve_try_another_op(self):
     current = ['hand empty', 'arm down']
     levitate_baseball = {
         'action': 'levitate baseball',
         'preconds': ['magic'],
         'add': ['baseball in air'],
         'delete': []
     }
     goal = 'baseball in air'
     new_ops = [levitate_baseball] + ops
     final = gps.achieve(current, new_ops, goal, [])
     expected = [
         'arm down', 'baseball in air', 'grabbing baseball', 'raising arm',
         'throwing baseball'
     ]
     self.assertEqual(set(expected), set(final))
Esempio n. 5
0
 def test_achieve_prevent_loop(self):
     current = ['hand empty', 'arm down']
     goal = 'baseball in air'
     stack = ['baseball in air', 'levitate']
     self.assertFalse(gps.achieve(current, ops, goal, stack))
Esempio n. 6
0
 def test_achieve_already_done(self):
     expected = ['hand empty', 'arm down']
     final = gps.achieve(expected, ops, 'arm down', [])
     self.assertEqual(set(expected), set(final))
Esempio n. 7
0
 def test_achieve_prevent_loop(self):
     current = ['hand empty', 'arm down']
     goal = 'baseball in air'
     stack = ['baseball in air', 'levitate']
     self.assertFalse(gps.achieve(current, ops, goal, stack))
Esempio n. 8
0
 def test_achieve_already_done(self):
     expected = ['hand empty', 'arm down']
     final = gps.achieve(expected, ops, 'arm down', [])
     self.assertEqual(set(expected), set(final))