TEST(tinybitset_unittest, test_bitset_init) { Bitset bitset; bool res = bitset.empty(); EXPECT_EQ(true, res); vector<int> bitones = bitset.getbitones(); EXPECT_EQ(0,bitones.size()); }
TEST(tinybitset_unittest, test_bitset_allsetones) { Bitset bitset; bitset.allsetones(); bool res = bitset.empty(); EXPECT_EQ(true, res); vector<int> bitones = bitset.getbitones(); EXPECT_EQ(128,bitones.size()); for(int i=0;i<bitones.size();i++){ EXPECT_EQ(i,bitones[i]); } }
TEST(tinybitset_unittest, test_bitset_normaltest) { Bitset bitset; bool res; for(int i=0;i<kNormalCaseNum;i++){ bitset.set(kNormalCase[i]); res = bitset.get(kNormalCase[i]); EXPECT_EQ(1,res); res = bitset.empty(); EXPECT_EQ(0,res); } vector<int> bitones = bitset.getbitones(); EXPECT_EQ(kNormalCaseNum,bitones.size()); for(int i=0;i<kNormalCaseNum;i++){ EXPECT_EQ(kNormalCase[i],bitones[i]); } }