예제 #1
0
    public void Two_nodes()
    {
        const string input    = "(;A[B];B[C])";
        var          expected = TreeWithSingleChild(CreateData("A", "B"), TreeWithNoChildren(CreateData("B", "C")));

        Assert.Equal(expected, SgfParser.ParseTree(input), SgfTreeEqualityComparer.Instance);
    }
예제 #2
0
    public void Node_without_properties()
    {
        const string input    = "(;)";
        var          expected = TreeWithNoChildren(new Dictionary <string, string[]>());

        Assert.Equal(expected, SgfParser.ParseTree(input), SgfTreeEqualityComparer.Instance);
    }
예제 #3
0
    public void Multiple_properties()
    {
        const string input    = "(;A[b][c][d])";
        var          expected = TreeWithNoChildren(CreateData("A", "b", "c", "d"));

        Assert.Equal(expected, SgfParser.ParseTree(input), SgfTreeEqualityComparer.Instance);
    }
예제 #4
0
    public void Escaped_property()
    {
        const string input    = @"(;A[\]b\nc\nd\t\te \n\]])";
        var          expected = TreeWithNoChildren(CreateData("A", "]b\nc\nd  e \n]"));

        Assert.Equal(expected, SgfParser.ParseTree(input), SgfTreeEqualityComparer.Instance);
    }
예제 #5
0
    public void Node_without_properties()
    {
        var encoded  = "(;)";
        var expected = new SgfTree(new Dictionary <string, string[]>());

        AssertEqual(expected, SgfParser.ParseTree(encoded));
    }
예제 #6
0
    public void Single_node_tree()
    {
        const string input    = "(;A[B])";
        var          expected = TreeWithNoChildren(CreateData("A", "B"));

        Assert.Equal(expected, SgfParser.ParseTree(input), SgfTreeEqualityComparer.Instance);
    }
예제 #7
0
    public void Escaped_property()
    {
        const string input    = @"(;A[\]b\nc\nd\t\te \n\]])";
        var          expected = TreeWithNoChildren(CreateData("A", @"]b c d  e  ]"));

        Assert.That(SgfParser.ParseTree(input), Is.EqualTo(expected).Using(SgfTreeEqualityComparer.Instance));
    }
예제 #8
0
    public void Multiple_property_values()
    {
        var encoded  = "(;A[b][c][d])";
        var expected = new SgfTree(new Dictionary <string, string[]> {
            ["A"] = new[] { "b", "c", "d" }
        });

        Assert.Equal(expected, SgfParser.ParseTree(encoded));
    }
예제 #9
0
    public void Escaped_property()
    {
        var encoded  = "(;A[\\]b\\nc\\nd\\t\\te \\n\\]])";
        var expected = new SgfTree(new Dictionary <string, string[]> {
            ["A"] = new[] { "]b\nc\nd  e \n]" }
        });

        AssertEqual(expected, SgfParser.ParseTree(encoded));
    }
예제 #10
0
    public void Single_node_tree()
    {
        var encoded  = "(;A[B])";
        var expected = new SgfTree(new Dictionary <string, string[]> {
            ["A"] = new[] { "B" }
        });

        AssertEqual(expected, SgfParser.ParseTree(encoded));
    }
예제 #11
0
    public void Multiple_properties()
    {
        var encoded  = "(;A[b]C[d])";
        var expected = new SgfTree(new Dictionary <string, string[]> {
            ["A"] = new[] { "b" }, ["C"] = new[] { "d" }
        });

        AssertEqual(expected, SgfParser.ParseTree(encoded));
    }
예제 #12
0
    public void Two_nodes()
    {
        var encoded  = "(;A[B];B[C])";
        var expected = new SgfTree(new Dictionary <string, string[]> {
            ["A"] = new[] { "B" }
        }, new SgfTree(new Dictionary <string, string[]> {
            ["B"] = new[] { "C" }
        }));

        AssertEqual(expected, SgfParser.ParseTree(encoded));
    }
예제 #13
0
    public void Two_child_trees()
    {
        const string input    = "(;A[B](;B[C])(;C[D]))";
        var          expected = TreeWithChildren(CreateData("A", "B"),
                                                 new[]
        {
            TreeWithNoChildren(CreateData("B", "C")),
            TreeWithNoChildren(CreateData("C", "D"))
        });

        Assert.Equal(expected, SgfParser.ParseTree(input), SgfTreeEqualityComparer.Instance);
    }
예제 #14
0
    public void Two_child_trees()
    {
        var encoded  = "(;A[B](;B[C])(;C[D]))";
        var expected = new SgfTree(new Dictionary <string, string[]> {
            ["A"] = new[] { "B" }
        }, new SgfTree(new Dictionary <string, string[]> {
            ["B"] = new[] { "C" }
        }), new SgfTree(new Dictionary <string, string[]> {
            ["C"] = new[] { "D" }
        }));

        AssertEqual(expected, SgfParser.ParseTree(encoded));
    }
예제 #15
0
    public void Tree_without_nodes()
    {
        const string input = "()";

        Assert.That(() => SgfParser.ParseTree(input), Throws.Exception);
    }
예제 #16
0
    public void Properties_without_delimiter()
    {
        const string input = "(;a)";

        Assert.Throws <ArgumentException>(() => SgfParser.ParseTree(input));
    }
예제 #17
0
    public void Empty_input()
    {
        var encoded = "";

        Assert.Throws <ArgumentException>(() => SgfParser.ParseTree(encoded));
    }
예제 #18
0
    public void Upper_and_lowercase_property()
    {
        var encoded = "(;Aa[b])";

        Assert.Throws <ArgumentException>(() => SgfParser.ParseTree(encoded));
    }
예제 #19
0
    public void Node_without_tree()
    {
        const string input = ";";

        Assert.That(() => SgfParser.ParseTree(input), Throws.Exception);
    }
예제 #20
0
    public void Properties_without_delimiter()
    {
        var encoded = "(;A)";

        Assert.Throws <ArgumentException>(() => SgfParser.ParseTree(encoded));
    }
예제 #21
0
    public void Upper_and_lowercase_property()
    {
        const string input = "(;Aa[b])";

        Assert.That(() => SgfParser.ParseTree(input), Throws.Exception);
    }
예제 #22
0
    public void Properties_without_delimiter()
    {
        const string input = "(;a)";

        Assert.That(() => SgfParser.ParseTree(input), Throws.Exception);
    }
예제 #23
0
    public void Tree_with_no_nodes()
    {
        var encoded = "()";

        Assert.Throws <ArgumentException>(() => SgfParser.ParseTree(encoded));
    }
예제 #24
0
    public void Node_without_tree()
    {
        var encoded = ";";

        Assert.Throws <ArgumentException>(() => SgfParser.ParseTree(encoded));
    }
예제 #25
0
    public void Empty_value()
    {
        const string input = "";

        Assert.Throws <ArgumentException>(() => SgfParser.ParseTree(input));
    }
예제 #26
0
    public void Tree_without_nodes()
    {
        const string input = "()";

        Assert.Throws <ArgumentException>(() => SgfParser.ParseTree(input));
    }
예제 #27
0
    public void Node_without_tree()
    {
        const string input = ";";

        Assert.Throws <ArgumentException>(() => SgfParser.ParseTree(input));
    }
예제 #28
0
    public void Upper_and_lowercase_property()
    {
        const string input = "(;Aa[b])";

        Assert.Throws <ArgumentException>(() => SgfParser.ParseTree(input));
    }
예제 #29
0
    public void Empty_value()
    {
        const string input = "";

        Assert.That(() => SgfParser.ParseTree(input), Throws.Exception);
    }