Exemplo n.º 1
0
TEST(ConnectXTest, checkHeight)
{
	ConnectX obj;
	obj.showBoard();
	obj.showBoard();
	obj.placePiece(0);
	obj.showBoard();
	obj.placePiece(0);
	obj.showBoard();
	obj.placePiece(0);
	obj.showBoard();
	obj.placePiece(0);
	obj.showBoard();
	obj.placePiece(0);
	obj.showBoard();
	obj.placePiece(0);
	obj.showBoard();
	obj.placePiece(0);
	obj.showBoard();
	obj.placePiece(9);
	obj.placePiece(-5);
	obj.placePiece(0);
	obj.showBoard();
	ASSERT_EQ(obj.whoseTurn(),2);
}
Exemplo n.º 2
0
TEST(ConnectXTest, turnCheck) // Check if there is proper turn switiching.
{
	ConnectX conn;
	ASSERT_EQ(2,conn.whoseTurn());
	conn.placePiece(3);
	ASSERT_EQ(1,conn.whoseTurn());
	conn.placePiece(2);
	ASSERT_EQ(2,conn.whoseTurn());
}
Exemplo n.º 3
0
TEST(ConnectXTest, checkNotWhiteTurn)
{
	ConnectX obj;
	obj.showBoard();
	obj.placePiece(0);
	obj.showBoard();
	obj.placePiece(0);
	obj.showBoard();
	ASSERT_EQ(obj.whoseTurn(),2);
}
Exemplo n.º 4
0
TEST(ConnectXText, placeTest)
{
  // this test crashes since bug in inBounds function
  ConnectX cx;
  ASSERT_TRUE(cx.whoseTurn() == ConnectX::BLACK);
  cx.placePiece(0);
  ASSERT_TRUE(cx.whoseTurn() == ConnectX::WHITE);
  cx.placePiece(1);
  ASSERT_TRUE(cx.whoseTurn() == ConnectX::BLACK);
  //cx.placePiece(-1);
  //ASSERT_TRUE(cx.whoseTurn() == ConnectX::WHITE);
  //cx.placePiece(-1);
  //ASSERT_TRUE(cx.whoseTurn() == ConnectX::BLACK);
}
Exemplo n.º 5
0
TEST(ConnectXTest, checkPlacePieceBelowZero)
{
	ConnectX obj;
	obj.placePiece(-1);
	obj.showBoard();
	ASSERT_EQ(obj.whoseTurn(),1);
}