Skip to content

Commit b1b8f37

Browse files
authored
987 Start print_table() with a line break (#989)
1 parent f59d955 commit b1b8f37

3 files changed

Lines changed: 5 additions & 5 deletions

File tree

cpp/memilio/utils/time_series.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -467,7 +467,7 @@ class TimeSeries
467467
// Note: input manipulators (like std::setw, std::left) are consumed by the first argument written to the stream
468468
// print column labels
469469
const auto w = width, p = precision;
470-
set_ostream_format(out, w, p) << std::left << "Time";
470+
set_ostream_format(out, w, p) << std::left << "\nTime";
471471
for (size_t k = 0; k < static_cast<size_t>(get_num_elements()); k++) {
472472
if (k < column_labels.size()) {
473473
out << " ";

cpp/tests/test_time_series.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -335,21 +335,21 @@ TYPED_TEST(TestTimeSeries, print_table)
335335
ts.get_time((Eigen::Index)0) = 0.0;
336336
ts.get_time((Eigen::Index)1) = 1.0;
337337

338-
std::string expected_output_1 = "Time col_1 col_2\n0.00 0.12 1.12\n1.00 1.12 2.12\n";
338+
std::string expected_output_1 = "\nTime col_1 col_2\n0.00 0.12 1.12\n1.00 1.12 2.12\n";
339339
ts.print_table({"col_1", "col_2"}, 4, 2, output);
340340
std::string actual_output_1 = output.str();
341341
EXPECT_EQ(expected_output_1, actual_output_1);
342342

343343
output.str("");
344344

345-
std::string expected_output_2 = "Time #1 #2 \n 0.0 0.1 1.1\n 1.0 1.1 2.1\n";
345+
std::string expected_output_2 = "\nTime #1 #2 \n 0.0 0.1 1.1\n 1.0 1.1 2.1\n";
346346
ts.print_table({}, 6, 1, output);
347347
std::string actual_output_2 = output.str();
348348
EXPECT_EQ(expected_output_2, actual_output_2);
349349

350350
output.str("");
351351

352-
std::string expected_output_3 = "Time col_1 #2 \n 0.0000 0.1235 "
352+
std::string expected_output_3 = "\nTime col_1 #2 \n 0.0000 0.1235 "
353353
"1.1235\n 1.0000 1.1235 2.1235\n";
354354
ts.print_table({"col_1"}, 12, 4, output);
355355
std::string actual_output_3 = output.str();

pycode/memilio-simulation/memilio/simulation_test/test_time_series.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ def test_print_table(self):
5959
ts.add_time_point(3.5, np.r_[2])
6060
output = ts.print_table(["a", "b"], 2, 2)
6161
self.assertEqual(
62-
output, 'Time a \n2.00 1.00\n3.50 2.00\n')
62+
output, '\nTime a \n2.00 1.00\n3.50 2.00\n')
6363

6464

6565
if __name__ == '__main__':

0 commit comments

Comments
 (0)