NodeLib { public static Hash hash(Node n) { Hash h = new Hash(LenNodeHash); setHash(h, n); return h; }  static long encodeStore(Node node, ObjectFile file); static long encodeStore(Node node, ObjectFile file, ByteBuffer bb); static Node fetchDecode(long id, ObjectFile file); static ByteBuffer encode(Node node); static Node decode(ByteBuffer bb); static Hash hash(Node n); static void setHash(Hash h, Node n); static NodeId getNodeId(Record r, int idx); static Node termOrAny(Node node); static Iterator<Node> nodes(final NodeTable nodeTable, Iterator<NodeId> iter);  }
@Test public void hash1() { Node x1 = NodeFactoryExtra.parseNode("<http: Node x2 = NodeFactoryExtra.parseNode("<http: assertEquals(hash(x1), hash(x2)) ; }
@Test public void hash2() { Node x1 = NodeFactoryExtra.parseNode("<http: Node x2 = NodeFactoryExtra.parseNode("<http: assertNotEquals(hash(x1), hash(x2)) ; }
@Test public void hash3() { Node x1 = NodeFactoryExtra.parseNode("<lex>") ; Node x2 = NodeFactoryExtra.parseNode("'lex'") ; Node x3 = NodeFactoryExtra.parseNode("_:lex") ; assertNotEquals(hash(x1), hash(x2)) ; assertNotEquals(hash(x2), hash(x3)) ; assertNotEquals(hash(x3), hash(x1)) ; }
@Test public void hash4() { Node x1 = NodeFactoryExtra.parseNode("123") ; Node x2 = NodeFactoryExtra.parseNode("'123'") ; assertNotEquals(hash(x1), hash(x2)) ; }
@Test public void hash5() { Node x1 = NodeFactoryExtra.parseNode("123") ; Node x2 = NodeFactoryExtra.parseNode("123.0") ; Node x3 = NodeFactoryExtra.parseNode("123e0") ; assertNotEquals(hash(x1), hash(x2)) ; assertNotEquals(hash(x2), hash(x3)) ; assertNotEquals(hash(x3), hash(x1)) ; }