public void LeafIsNotNode() { var sut = new RoseLeaf <bool, double>(-4); var actual = sut.IsNode(); Assert.False(actual.ToBool()); }
public void MatchLeaf() { IRoseTree <string, int> tree = new RoseLeaf <string, int>(42); int actual = tree.Accept(new MatchIntLeafVisitor()); Assert.Equal(42, actual); }
public void LeafIsLeaf() { var sut = new RoseLeaf <bool, double>(2); var actual = sut.IsLeaf(); Assert.True(actual.ToBool()); }
public void CataLeaf() { IRoseTree <string, int> tree = new RoseLeaf <string, int>(42); int actual = tree.Cata((x, xs) => x.Length + xs.Sum(), x => x); Assert.Equal(42, actual); }