EXPECT_THAT(actual, testing::UnorderedElementsAreArray(expected));
}
}
+
+TEST(Board, GoodInput) {
+ std::istringstream is{"15,14,9,13,3,1,12,8,0,11,6,4,7,5,2,10"};
+ Board b;
+ is >> b;
+ EXPECT_FALSE(is.fail());
+ EXPECT_TRUE(is.eof());
+ EXPECT_THAT(b, testing::ElementsAreArray({15,14,9,13,3,1,12,8,0,11,6,4,7,5,2,10}));
+}
+
+TEST(Board, ShortInput) {
+ std::istringstream is{"15,14,9,13,3,1,12,8,0,11,6,4,7,5,2"};
+ Board b;
+ is >> b;
+ EXPECT_TRUE(is.fail());
+}
+
+TEST(Board, NonNumericInput) {
+ std::istringstream is{"15,14,foo,13,3,1,12,8,0,11,6,4,7,5,2,10"};
+ Board b;
+ is >> b;
+ EXPECT_TRUE(is.fail());
+}