我想知道我是在测试我在这个测试中列出的所有等式,还是只测试第一个。
class SomethingTest : public testing::Test
{
public:
SomethingTest() { }
virtual ~SomethingTest() { }
};
TEST_F(SomethingTest, Score)
{
Computer computer;
FourInARowStrategy* strategy = new FourInARowStrategy();
vector<vector<int>> brd;
for(int i=0; i<6 ;i++)
{
vector<int> row ;
for(int j=0;j<7;j++)
row.push_back(0);
brd.push_back(row);
}
brd[5][5]=1;
brd[5][4]=2;
brd[5][3]=1;
brd[5][2]=1;
brd[5][1]=1;
brd[4][5]=2;
brd[4][4]=2;
brd[4][3]=1;
brd[4][2]=1;
brd[3][2]=2;
brd[3][1]=2;
brd[4][1]=2;
strategy->setGameBoard(brd);
strategy->displayBoard();
EXPECT_EQ(9,computer.rowScoreAPlay(2,3,3,strategy));
EXPECT_EQ(9,computer.scoreAPlay(2,3,3,strategy));
EXPECT_EQ(0,computer.colScoreAPlay(2,3,3,strategy));
EXPECT_EQ(5,computer.colScoreAPlay(1,3,3,strategy));
}
//...
}
您是否会参考 google 的单元测试和良好的单元测试开发?
谢谢并恭祝安康。