use of mb.nabl2.terms.ITerm in project nabl by metaborg.
the class HashcodeAndEqualsTest method testGenericAndSpecializedEqual.
@Test
public void testGenericAndSpecializedEqual() {
ITerm t1 = B.newAppl(SpecializedAppl.OP, B.newString("Hello, world!"), B.newInt(42));
ITerm t2 = ImmutableSpecializedAppl.of("Hello, world!", 42);
assertEquals(t1.hashCode(), t2.hashCode());
assertTrue(t1.equals(t2));
}
use of mb.nabl2.terms.ITerm in project nabl by metaborg.
the class HashcodeAndEqualsTest method testSameInts.
@Test
public void testSameInts() {
ITerm t1 = B.newInt(1);
ITerm t2 = B.newInt(1);
assertEquals(t1.hashCode(), t2.hashCode());
assertTrue(t1.equals(t2));
}
use of mb.nabl2.terms.ITerm in project nabl by metaborg.
the class HashcodeAndEqualsTest method testGenericApplEqualAfterSerialization.
@Test
public void testGenericApplEqualAfterSerialization() throws Exception {
ITerm t1 = B.newAppl(SpecializedAppl.OP, B.newString("Hello, world!"), B.newInt(42));
ITerm t2 = deserialize(serialize(t1));
assertEquals(t1.hashCode(), t2.hashCode());
assertTrue(t1.equals(t2));
}
use of mb.nabl2.terms.ITerm in project nabl by metaborg.
the class HashcodeAndEqualsTest method testSpecializedApplEqualAfterSerialization.
@Test
public void testSpecializedApplEqualAfterSerialization() throws Exception {
ITerm t1 = ImmutableSpecializedAppl.of("Hello, world!", 42);
ITerm t2 = deserialize(serialize(t1));
assertEquals(t1.hashCode(), t2.hashCode());
assertTrue(t1.equals(t2));
}
use of mb.nabl2.terms.ITerm in project nabl by metaborg.
the class HashcodeAndEqualsTest method testDifferentInts.
@Test
public void testDifferentInts() {
ITerm t1 = B.newInt(1);
ITerm t2 = B.newInt(2);
assertFalse(t1.equals(t2));
}
Aggregations