Add a test case for day 7
authorUmmon <greg.burri@gmail.com>
Fri, 8 Dec 2017 07:24:37 +0000 (08:24 +0100)
committerUmmon <greg.burri@gmail.com>
Fri, 8 Dec 2017 07:24:37 +0000 (08:24 +0100)
Tests/Day7 tests.fs

index 022e615..0565ab1 100644 (file)
@@ -53,4 +53,26 @@ type ``Day7 tests`` (output : ITestOutputHelper) =
         | Some (tower, weight) ->
             tower.Name =! "ugml"
             weight =! 60
-        | None -> failwith "no tower found"
\ No newline at end of file
+        | None -> failwith "no tower found"
+
+    [<Fact>]
+    let ``(Part2) A balanced tree`` () =
+        let input =
+            [
+                "pbga (66)"
+                "xhth (57)"
+                "ebii (61)"
+                "havc (66)"
+                "ktlj (57)"
+                "fwft (72) -> ktlj, cntj, xhth"
+                "qoyq (66)"
+                "padx (45) -> pbga, havc, qoyq"
+                "tknk (41) -> ugml, padx, fwft"
+                "jptl (61)"
+                "ugml (60) -> gyxo, ebii, jptl"
+                "gyxo (61)"
+                "cntj (57)"
+            ]
+        let tower = Day7.buildTower (Day7.parseInput input)
+
+        Day7.findUnbalanced tower =! None
\ No newline at end of file