我在想我是否正在測試我在此測試中列出的所有平等性,還是我只測試第一個。googleTest繼續測試
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));
}
//...
}
你會參考谷歌的單元測試和良好的單元測試開發嗎?
感謝和問候。
好裁判喜歡自己的文檔(http://code.google。 com/p/googletest/wiki/Primer)? – PlasmaHH 2012-07-06 10:07:13