package com.fasterxml.jackson.jr.stree;

import com.fasterxml.jackson.core.TreeNode;
import com.fasterxml.jackson.jr.ob.JSON;

public class JrsValueEqualsTest extends JacksonJrTreeTestBase
{
    private final JSON treeJSON = jsonWithTreeCodec();

    public void testObjectEquality() throws Exception
    {
        final String INPUT = "{\"a\":1,\"b\":true,\"c\":3}";
        TreeNode tree = treeJSON.treeFrom(INPUT);
        assertEquals(tree, tree);
        assertEquals(tree, treeJSON.treeFrom(INPUT));
        assertEquals(treeJSON.treeFrom(INPUT), tree);

        final String INPUT2 = "{\"a\":1,\"b\":true}";
        TreeNode tree2 = treeJSON.treeFrom(INPUT2);
        assertEquals(tree2, tree2);

        assertFalse(tree2.equals(tree));
        assertFalse(tree.equals(tree2));
    }

    public void testArrayEquality() throws Exception
    {
        final String INPUT = "[true,\"abc\"]";
        final TreeNode tree = treeJSON.treeFrom(INPUT);
        assertEquals(tree, tree);
        assertEquals(tree, treeJSON.treeFrom(INPUT));
        assertEquals(treeJSON.treeFrom(INPUT), tree);

        final String INPUT2 = "[false,\"abc\"]";
        final TreeNode tree2 = treeJSON.treeFrom(INPUT2);
        assertEquals(tree2, tree2);

        assertFalse(tree2.equals(tree));
        assertFalse(tree.equals(tree2));
    }

    public void testScalarEquality() throws Exception
    {
        assertEquals(treeJSON.treeFrom("12"), treeJSON.treeFrom("12"));
        assertFalse(treeJSON.treeFrom("12").equals(treeJSON.treeFrom("-12")));

        assertEquals(treeJSON.treeFrom("true"), treeJSON.treeFrom("true"));
        assertFalse(treeJSON.treeFrom("true").equals(treeJSON.treeFrom("137")));

        assertEquals(treeJSON.treeFrom(q("name")), treeJSON.treeFrom(q("name")));
        assertFalse(treeJSON.treeFrom(q("true")).equals(treeJSON.treeFrom("true")));
    }
}

@@ -1388,37 +1388,40 @@
   %7B%0A        
-assertEquals(
+TreeNode tree = 
 treeJSON.tre
@@ -1431,16 +1431,43 @@
 om(%2212%22)
+;%0A        assertEquals(tree
 , treeJS
@@ -1570,37 +1570,31 @@
 );%0A%0A        
-assertEquals(
+tree = 
 treeJSON.tre
@@ -1606,16 +1606,43 @@
 (%22true%22)
+;%0A        assertEquals(tree
 , treeJS
@@ -1749,37 +1749,31 @@
 );%0A%0A        
-assertEquals(
+tree = 
 treeJSON.tre
@@ -1788,16 +1788,43 @@
 %22name%22))
+;%0A        assertEquals(tree
 , treeJS

Fix test (not sure why it had failed)