Exemple #1
0
    public void StreamWalkTests()
    {
        Stream stream = new Stream();

        // Const value
        Assert.AreEqual(Pair.Value("test"), stream.Walk(Pair.Value("test")));

        // Variable -> Value
        Pair   a         = Pair.Fresh();
        Stream newStream = stream.AddAssociation(a, Pair.Value("test"));

        Assert.AreEqual(newStream.Walk(a.key), "test");

        // Variable -> Assigned variable
        Pair b = Pair.Fresh();

        newStream = newStream.AddAssociation(b, a);
        Assert.AreEqual(newStream.Walk(b.key), "test");

        // Variable -> Unassigned variable
        Stream newStream2 = new Stream();

        newStream2 = stream.AddAssociation(a, b);
        Assert.AreEqual(newStream2.Walk(a), b);
    }