]> git.scottworley.com Git - slidingtile/blobdiff - sliding_tile_lib_test.cc
A where's-the-hole function.
[slidingtile] / sliding_tile_lib_test.cc
index 7f032a436761d278e8fdf61230f0d94607516408..12cc46b8a051394b03d7fd93b7d724a25917c92c 100644 (file)
@@ -76,3 +76,13 @@ TEST(Board, HighTileInput) {
   is >> b;
   EXPECT_TRUE(is.fail());
 }
+
+TEST(Board, Hole) {
+  Board b{{16,14,9,13,3,1,12,8,0,11,6,4,7,5,2,10}};
+  EXPECT_EQ(8, b.hole());
+}
+
+TEST(Board, NoHole) {
+  Board b{{16,14,9,13,3,1,12,8,16,11,6,4,7,5,2,10}};
+  EXPECT_THROW(b.hole(), std::runtime_error);
+}