public void WhenNodeHasNoChildrenAndSomeMetadataValueIsSumOfMetadata() { var n = new Node( ImmutableList <Node> .Empty, ImmutableList.Create(1, 2, 3, 4)); Assert.AreEqual(10, n.CalculateValue()); }
public void IdgPart2() { if (!LiveTestHacks.RunningInVsLiveTest) { Node inputNode = InputReader.ParseLines(typeof(Program), NodeParser).Single(); Assert.AreEqual(24262, inputNode.CalculateValue()); } }
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()); }
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()); }
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()); }
public void WhenNodeHasNoChildrenAndNoMetadataValueIsZero() { var n = new Node(ImmutableList <Node> .Empty, ImmutableList <int> .Empty); Assert.AreEqual(0, n.CalculateValue()); }