Beispiel #1
0
        public void GlobalSetup()
        {
            JsonStringSolution root = null;

            switch (testcase)
            {
            case Testcase.givenValues: root = givenTest; break;

            case Testcase.depth5: root = generateDepth(5); break;

            case Testcase.depth10: root = generateDepth(10); break;

            case Testcase.depth15: root = generateDepth(15); break;
            }

            jsonString = BinaryTreeNode <JsonStringSolution> .CreateFrom <JsonStringSolution, JsonStringSolution>(root);

            sExps = BinaryTreeNode <SExpsSolution> .CreateFrom <JsonStringSolution, SExpsSolution>(root);
        }
Beispiel #2
0
        public void ValueEquality()
        {
            var sameA  = new SExpsSolution("root", new SExpsSolution("left", new SExpsSolution("left.left")), new SExpsSolution("right"));
            var sameB  = new SExpsSolution("root", new SExpsSolution("left", new SExpsSolution("left.left")), new SExpsSolution("right"));
            var differ = new SExpsSolution("root", new SExpsSolution("læft", new SExpsSolution("left left")), new SExpsSolution("right"));

            HashSet <SExpsSolution> hhh = new HashSet <SExpsSolution>();

            hhh.Add(sameA);

            Assert.True(sameA.Equals(sameA));
            Assert.True(sameA.Equals(sameB));
            Assert.False(sameA.Equals(differ));

            Assert.True(sameA == sameA);
            Assert.True(sameA == sameB);
            Assert.False(sameA == differ);

            Assert.Contains(sameA, hhh);
            Assert.Contains(sameB, hhh);
            Assert.DoesNotContain(differ, hhh);
        }
Beispiel #3
0
 public SExpsSolution SExps() => SExpsSolution.Deserialize(jsonString.Serialize());
Beispiel #4
0
 public void Deserialization()
 => Assert.Equal
     (new SExpsSolution("root", new SExpsSolution("left", new SExpsSolution("left.left")), new SExpsSolution("right"))
     , SExpsSolution.Deserialize("null null right null null null left.left left root")
     );