@@ -21,12 +21,12 @@ namespace
2121{
2222 using namespace FourC ;
2323
24- void check_section (
24+ void check_section_rank_0_only (
2525 Core::IO::InputFile& input, const std::string& section, const std::vector<std::string>& lines)
2626 {
2727 SCOPED_TRACE (" Checking section " + section);
2828 ASSERT_TRUE (input.has_section (section));
29- auto section_lines = input.in_section (section);
29+ auto section_lines = input.in_section_rank_0_only (section);
3030 std::vector<std::string> section_lines_str;
3131 std::ranges::copy (section_lines | std::views::transform ([](const auto & line)
3232 { return std::string{line.get_as_dat_style_string ()}; }),
@@ -57,10 +57,12 @@ namespace
5757 EXPECT_TRUE (input.has_section (" EMPTY" ));
5858 EXPECT_FALSE (input.has_section (" NONEXISTENT SECTION" ));
5959
60- check_section (input, " SECTION WITH SPACES" , {" line in section with spaces" });
61- check_section (input, " SECTION/WITH/SLASHES" , {" line in section with slashes" });
62- check_section (input, " SHORT SECTION" , std::vector<std::string>(3 , " line in short section" ));
63- check_section (input, " PARTICLES" , std::vector<std::string>(30 , " line in long section" ));
60+ check_section_rank_0_only (input, " SECTION WITH SPACES" , {" line in section with spaces" });
61+ check_section_rank_0_only (input, " SECTION/WITH/SLASHES" , {" line in section with slashes" });
62+ check_section_rank_0_only (
63+ input, " SHORT SECTION" , std::vector<std::string>(3 , " line in short section" ));
64+ check_section_rank_0_only (
65+ input, " PARTICLES" , std::vector<std::string>(30 , " line in long section" ));
6466 }
6567
6668 TEST (InputFile, HasIncludes)
@@ -86,11 +88,11 @@ namespace
8688 EXPECT_EQ (input.file_for_section (" INCLUDED SECTION 1a" ).filename (), " include1a.dat" );
8789 EXPECT_EQ (input.file_for_section (" SECTION 1" ).filename (), " main.dat" );
8890
89- check_section (input, " INCLUDED SECTION 1a" , std::vector<std::string>(2 , " line" ));
90- check_section (input, " INCLUDED SECTION 1b" , std::vector<std::string>(2 , " line" ));
91- check_section (input, " INCLUDED SECTION 2" , std::vector<std::string>(2 , " line" ));
92- check_section (input, " INCLUDED SECTION 3" , std::vector<std::string>(2 , " line" ));
93- check_section (input, " PARTICLES" , std::vector<std::string>(5 , " line" ));
91+ check_section_rank_0_only (input, " INCLUDED SECTION 1a" , std::vector<std::string>(2 , " line" ));
92+ check_section_rank_0_only (input, " INCLUDED SECTION 1b" , std::vector<std::string>(2 , " line" ));
93+ check_section_rank_0_only (input, " INCLUDED SECTION 2" , std::vector<std::string>(2 , " line" ));
94+ check_section_rank_0_only (input, " INCLUDED SECTION 3" , std::vector<std::string>(2 , " line" ));
95+ check_section_rank_0_only (input, " PARTICLES" , std::vector<std::string>(5 , " line" ));
9496 }
9597
9698 TEST (InputFile, CyclicIncludes)
@@ -122,7 +124,8 @@ namespace
122124 EXPECT_FALSE (input.has_section (" EMPTY" ));
123125 EXPECT_FALSE (input.has_section (" NONEXISTENT SECTION" ));
124126
125- check_section (input, " SECTION WITH LINES" , {" first line" , " second line" , " third line" });
127+ check_section_rank_0_only (
128+ input, " SECTION WITH LINES" , {" first line" , " second line" , " third line" });
126129 }
127130
128131 TEST (InputFile, YamlIncludes)
@@ -146,8 +149,9 @@ namespace
146149 comm};
147150 input.read (input_file_name);
148151
149- check_section (input, " INCLUDED SECTION 1" , std::vector<std::string>(2 , " line" ));
150- check_section (input, " SECTION WITH SUBSTRUCTURE" , {" MAT 1 THERMO COND 1 2 3 CAPA 2" });
152+ check_section_rank_0_only (input, " INCLUDED SECTION 1" , std::vector<std::string>(2 , " line" ));
153+ check_section_rank_0_only (
154+ input, " SECTION WITH SUBSTRUCTURE" , {" MAT 1 THERMO COND 1 2 3 CAPA 2" });
151155
152156 EXPECT_EQ (input.file_for_section (" INCLUDED SECTION 2" ).filename (), " included.yaml" );
153157
0 commit comments