Exemple #1
0
        public void WhenNodeHasNoChildrenAndSomeMetadataValueIsSumOfMetadata()
        {
            var n = new Node(
                ImmutableList <Node> .Empty,
                ImmutableList.Create(1, 2, 3, 4));

            Assert.AreEqual(10, n.CalculateValue());
        }
Exemple #2
0
 public void IdgPart2()
 {
     if (!LiveTestHacks.RunningInVsLiveTest)
     {
         Node inputNode = InputReader.ParseLines(typeof(Program), NodeParser).Single();
         Assert.AreEqual(24262, inputNode.CalculateValue());
     }
 }
Exemple #3
0
        public void WhenNodeHasChildrenAndMetadataReferringToFirstChildValueIsChildValue()
        {
            var cn1 = new Node(
                ImmutableList <Node> .Empty,
                ImmutableList.Create(1, 2, 3, 4));
            var cn2 = new Node(
                ImmutableList <Node> .Empty,
                ImmutableList.Create(19, 23));
            var n = new Node(ImmutableList.Create(cn1, cn2), ImmutableList.Create(1));

            Assert.AreEqual(10, n.CalculateValue());
        }
Exemple #4
0
        public void WhenNodeHasChildrenAndMetadataThatIsAllOutOfRangeValueIsZero()
        {
            var cn1 = new Node(
                ImmutableList <Node> .Empty,
                ImmutableList.Create(1, 2, 3, 4));
            var cn2 = new Node(
                ImmutableList <Node> .Empty,
                ImmutableList.Create(19, 23));
            var n = new Node(ImmutableList.Create(cn1, cn2), ImmutableList.Create(99, 1234));

            Assert.AreEqual(0, n.CalculateValue());
        }
Exemple #5
0
        public void WhenNodeHasChildrenAndNoMetadataValueIsZero()
        {
            var cn1 = new Node(
                ImmutableList <Node> .Empty,
                ImmutableList.Create(1, 2, 3, 4));
            var cn2 = new Node(
                ImmutableList <Node> .Empty,
                ImmutableList.Create(19, 23));
            var n = new Node(ImmutableList.Create(cn1, cn2), ImmutableList <int> .Empty);

            Assert.AreEqual(0, n.CalculateValue());
        }
Exemple #6
0
        public void WhenNodeHasNoChildrenAndNoMetadataValueIsZero()
        {
            var n = new Node(ImmutableList <Node> .Empty, ImmutableList <int> .Empty);

            Assert.AreEqual(0, n.CalculateValue());
        }