Test GetSectionSize
| 13 | |
| 14 | // Test GetSectionSize |
| 15 | TEST_F(TestSections, TestGetSectionSize) { |
| 16 | std::string input = "[section1]\n" |
| 17 | "key1 = value1\n" |
| 18 | "key2 = value2\n" |
| 19 | "key3 = value3\n" |
| 20 | "\n" |
| 21 | "[section2]\n" |
| 22 | "key1 = value1\n" |
| 23 | "\n" |
| 24 | "[empty]\n"; |
| 25 | |
| 26 | SI_Error rc = ini.LoadData(input); |
| 27 | ASSERT_EQ(rc, SI_OK); |
| 28 | |
| 29 | int size = ini.GetSectionSize("section1"); |
| 30 | ASSERT_EQ(size, 3); |
| 31 | |
| 32 | size = ini.GetSectionSize("section2"); |
| 33 | ASSERT_EQ(size, 1); |
| 34 | |
| 35 | size = ini.GetSectionSize("empty"); |
| 36 | ASSERT_EQ(size, 0); |
| 37 | |
| 38 | // Non-existent section |
| 39 | size = ini.GetSectionSize("missing"); |
| 40 | ASSERT_EQ(size, -1); |
| 41 | } |
| 42 | |
| 43 | // Test GetSectionSize with multikey |
| 44 | TEST_F(TestSections, TestGetSectionSizeMultikey) { |
nothing calls this directly
no test coverage detected