Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package test;
 
 import  junit.framework.TestCase;

JUnit test case for syntax package
public class StringTermTest extends TestCase {
    public void testParsing() {
        StringTerm s = StringTermImpl.parseString("\"a\"");
        assertEquals(s.getString(), "a");
        assertEquals(s.toString(), "\"a\"");
        assertEquals(snew StringTermImpl("a"));
        
        //s = StringTermImpl.parseString("\"a(\\\\\"k\\\\\")\"");
        //System.out.println(s);
        //assertEquals(s.getString(), "a(\"k\")");
    }
    
    public void testUnify() {
        Term t1 = new StringTermImpl("bla");
        Term t2 = new StringTermImpl("bla");
        Term t3 = new StringTermImpl("notbla");
        
        Unifier u = new Unifier();
        assertTrue(u.unifies(t1t2));
        assertFalse(u.unifies(t1t3));
        
        Term v1 = new VarTerm("X");
        assertTrue(u.unifies(t1v1));
        assertTrue(u.unifies(t2v1));
        assertFalse(u.unifies(v1t3));
        
    }
New to GrepCode? Check out our FAQ X