Пример #1
0
TEST(ConnectXTest, checkPlacePieceBelowZero)
{
	ConnectX obj;
	obj.placePiece(-1);
	obj.showBoard();
	ASSERT_EQ(obj.whoseTurn(),1);
}
Пример #2
0
TEST(ConnectXTest, sanityCheck) // Display board basic test.
{
	ConnectX conn;
	conn.showBoard();
	ASSERT_TRUE(true);
	
}
Пример #3
0
TEST(ConnectXTest, checkWhiteTurn)
{
	ConnectX obj;
	obj.showBoard();
	obj.placePiece(0);
	obj.showBoard();
	ASSERT_EQ(obj.whoseTurn(),1);
}
Пример #4
0
TEST(ConnectXTest, boundsTest)
{
  ConnectX cx;
  ASSERT_TRUE(cx.at(DEFAULT_WIDTH - 1, DEFAULT_HEIGHT - 1) == ConnectX::EMPTY);
  ASSERT_TRUE(cx.at(DEFAULT_WIDTH, DEFAULT_HEIGHT - 1) == ConnectX::INVALID);
  ASSERT_TRUE(cx.at(DEFAULT_WIDTH - 1, DEFAULT_HEIGHT) == ConnectX::INVALID);
  ASSERT_TRUE(cx.at(-1, -1) == ConnectX::INVALID);
  ASSERT_TRUE(cx.at(-1, 0) == ConnectX::INVALID);
  ASSERT_TRUE(cx.at(0, -1) == ConnectX::INVALID);
}
Пример #5
0
TEST(ConnectXTest, checkAtAllBounds)
{
	ConnectX obj;
	bool n1,n2,n3,n4;
	n1 = obj.at(0,-1);
	n2 = obj.at(0,10);
	n3 = obj.at(20,30);
	n4 = obj.at(-3,40);
	ASSERT_TRUE(n1);
	ASSERT_TRUE(n2);
	ASSERT_TRUE(n3);
	ASSERT_TRUE(n4);
}
Пример #6
0
TEST(ConnectXTest, checkSizesInitial)
{
  // default sizes
  ConnectX cx;
  ASSERT_TRUE(cx.at(DEFAULT_WIDTH - 1, DEFAULT_HEIGHT - 1) == ConnectX::EMPTY);
  ASSERT_TRUE(cx.at(DEFAULT_WIDTH, DEFAULT_HEIGHT) == ConnectX::INVALID);
  ASSERT_TRUE(cx.whoseTurn() == ConnectX::BLACK);

  for(int w = 0; w < DEFAULT_WIDTH; ++w)
    for(int h = 0; h < DEFAULT_HEIGHT; ++h)
      ASSERT_TRUE(cx.at(w, h) == ConnectX::EMPTY);

  ConnectX cx_small(DEFAULT_WIDTH - 2, DEFAULT_HEIGHT - 2, 2);
  ASSERT_TRUE(cx_small.whoseTurn() == ConnectX::BLACK);
}
Пример #7
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());
}
Пример #8
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);
}
Пример #9
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);
}
Пример #10
0
TEST(ConnectXTest, checkBlackTurn)
{
	ConnectX obj;
	obj.showBoard();
	ASSERT_EQ(obj.whoseTurn(),2);
}
Пример #11
0
TEST(ConnectXTest, testDefaultWidthOutBoundsFalse)
{
	ConnectX obj; //default width=7,height=6, win=4
	ASSERT_EQ(obj.at(10,1),-1);
}
Пример #12
0
TEST(ConnectXTest, testNegativeWidthHeightInvalid)
{
	ConnectX obj;
	ASSERT_EQ(obj.at(-100,-1),-1);
}
Пример #13
0
TEST(ConnectXTest, showTest)
{
  ConnectX cx;
  cx.showBoard();
}