@@ -25,13 +25,8 @@ TEST(INIReader, get_vector) {
2525 const std::vector<int > ans1{1 , 2 , 3 };
2626 const std::vector<std::string> ans2{" 1" , " 2" , " 3" };
2727
28- const auto & vec1 = r.GetVector <int >(" section2" , " any_vec" );
29- const auto & vec2 = r.GetVector <>(" section2" , " any_vec" );
30-
31- for (int i = 0 ; i < ans1.size (); ++i) {
32- EXPECT_EQ (vec1[i], ans1[i]);
33- EXPECT_EQ (vec2[i], ans2[i]);
34- }
28+ ASSERT_EQ (r.GetVector <int >(" section2" , " any_vec" ), ans1);
29+ ASSERT_EQ (r.GetVector <>(" section2" , " any_vec" ), ans2);
3530}
3631
3732TEST (INIReader, get_single_value_with_default) {
@@ -58,18 +53,16 @@ TEST(INIReader, get_vector_with_default) {
5853 const auto & vec1 = r.GetVector <int >(" section2" , " not_exist" , ans1);
5954 const auto & vec2 = r.GetVector <std::string>(" section2" , " not_exist" , std::vector<std::string>{" 1" , " 2" , " 3" });
6055 const auto & vec3 = r.GetVector <double >(" section2" , " doubles" , std::vector<double >{0 });
61-
62- for (int i = 0 ; i < ans1.size (); ++i) {
63- EXPECT_EQ (vec1[i], ans1[i]);
64- EXPECT_EQ (vec2[i], ans2[i]);
65- EXPECT_EQ (vec3[i], ans3[i]);
66- }
56+
57+ ASSERT_EQ (vec1, ans1);
58+ ASSERT_EQ (vec2, ans2);
59+ ASSERT_EQ (vec3, ans3);
6760}
6861
6962
7063TEST (INIReader, exception) {
7164
72-
65+
7366 EXPECT_THROW (INIReader{" QQ" }, std::runtime_error); // file not found
7467 EXPECT_THROW (INIReader{" ./fixtures/bad_file.ini" }, std::runtime_error); // parse error
7568
@@ -82,15 +75,15 @@ TEST(INIReader, exception) {
8275 // parse error
8376 EXPECT_THROW (r.Get <int >(" section1" , " not_int" ), std::runtime_error);
8477 EXPECT_THROW (r.GetVector <int >(" section1" , " not_int_arr" ), std::runtime_error);
85-
78+
8679}
8780
8881
8982TEST (INIReader, read_big_file) {
9083 INIReader r{" ./fixtures/bigfile.ini" };
91-
84+
9285 for (int i = 1 ; i <= 1000 ; ++i) {
9386 const auto & v = r.Get <int >(" section" , " key" + std::to_string (i));
9487 EXPECT_EQ (v, i);
9588 }
96- }
89+ }
0 commit comments