0
我成功地在我的小程序上設置了Google測試,並生成了夾具類。我嘗試測試我的類族譜的整數「start_ind_id_array_」公共成員向量的大小。 下面是代碼:Google測試夾具:通過一個班級成員尺寸
class BuildgenTest : public ::testing::Test {
protected:
virtual void SetUp(){
const string pedigree_fileName("../input_files/genealogies.txt");
const string start_filename("../input_files/start");
Genealogy curGen;
curGen.ReadPedigree(pedigree_fileName.c_str());
curGen.SetStartIndividual(start_filename.c_str());
cout << curGen.start_ind_id_array_.size() <<"\n" ;
}
Genealogy curGen;
};
TEST_F(BuildgenTest,veriftest){
int number_of_starting_individuals = curGen.start_ind_id_array_.size();
EXPECT_EQ(number_of_starting_individuals,3916);
}
第一COUT給我我所期望的數字,3916但後來我的測試EXPECT_EQ失敗,因爲我的數組的大小是現在0,不是我預期3916
任何想法是什麼造成這個?
謝謝!我刪除了安裝程序中的版本,現在它工作正常。我應該想到這一點。乾杯。 – ElCascador