예제 #1
0
 def test_convert_conjunction(self):
     call = Compound('call', Variable('X'))
     term = Compound(',', Variable('X'), call)
     goal = convert_to_goal(term)
     self.assertEquals(',/2', goal.predicate_indicator())
     self.assertEquals(call, goal.value[1])
     self.assertEquals(call, goal.value[2])
예제 #2
0
 def test_convert_disjunction(self):
     term = Compound(';', Variable('X'), Atomic('p'))
     goal = convert_to_goal(term)
     self.assertEquals(';/2', goal.predicate_indicator())
     self.assertEquals(Compound('call', Variable('X')), goal.value[1])
     self.assertEquals(Atomic('p'), goal.value[2])
예제 #3
0
 def test_convert_call(self):
     term = Compound('call', Variable('X'))
     self.assertEquals(term, convert_to_goal(term))
예제 #4
0
 def test_convert_variable(self):
     term = Variable('X')
     goal = Compound('call', term)
     self.assertEquals(goal, convert_to_goal(term))
예제 #5
0
 def test_convert_number(self):
     term = Atomic(3)
     self.assertTrue(convert_to_goal(term) is None)
예제 #6
0
 def test_convert_compound(self):
     term = Compound('f', Variable('X'), Atomic('g'))
     self.assertEquals(term, convert_to_goal(term))