* Test method for 'camembert.prover.Unifier.mgu(Fact, Fact)'
*/
public void testBasicMgu()
{
GdlList l1, l2;
Fact f1, f2;
Substitution sigma;
l1 = parser_.parse("foo baz bar");
l2 = parser_.parse("foo baz bar");
f1 = VariableFact.fromList(l1);
f2 = GroundFact.fromList(l2);
sigma = Unifier.mgu(f1, f2);
assertNotNull(sigma);
assertEquals(0, sigma.numMappings());
l1 = parser_.parse("foo ?x bar");
l2 = parser_.parse("foo baz bar");
f1 = VariableFact.fromList(l1);
f2 = GroundFact.fromList(l2);
sigma = Unifier.mgu( f1, f2 );
assertNotNull(sigma);
assertEquals( f2.getTerm( 0 ),
sigma.getMapping( (TermVariable) f1.getTerm( 0 ) ) );
assertEquals(1, sigma.numMappings());
l1 = parser_.parse("foo ?x ?x");
l2 = parser_.parse("foo baz ?y");
f1 = VariableFact.fromList(l1);
f2 = VariableFact.fromList(l2);
sigma = Unifier.mgu(f1,f2);
assertNotNull(sigma);
assertEquals( f2.getTerm(0), sigma.getMapping( (TermVariable) f1.getTerm(0)) );
assertEquals( f2.getTerm(0), sigma.getMapping( (TermVariable) f1.getTerm(1)) );
assertEquals( f2.getTerm(0), sigma.getMapping( (TermVariable) f2.getTerm(1)) );
assertEquals(2, sigma.numMappings());
}