[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lmi-commits] [lmi] master 1463d87 1/3: Improve unit test
From: |
Greg Chicares |
Subject: |
[lmi-commits] [lmi] master 1463d87 1/3: Improve unit test |
Date: |
Sun, 12 Aug 2018 09:55:52 -0400 (EDT) |
branch: master
commit 1463d87ec5348fb2c258aa7c1e6e61c9f2af7ce1
Author: Gregory W. Chicares <address@hidden>
Commit: Gregory W. Chicares <address@hidden>
Improve unit test
Write auxiliary functions in an unnamed namespace, in alphabetical
order. Use a more plausible diagnostic string in a commented-out test.
---
report_table_test.cpp | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/report_table_test.cpp b/report_table_test.cpp
index ebe4485..bb7161a 100644
--- a/report_table_test.cpp
+++ b/report_table_test.cpp
@@ -27,6 +27,13 @@
#include <numeric> // accumulate()
+namespace
+{
+int sum(std::vector<int> z)
+{
+ return std::accumulate(z.begin(), z.end(), 0);
+}
+
std::vector<int> widths(std::vector<table_column_info> const& z)
{
std::vector<int> v;
@@ -36,11 +43,7 @@ std::vector<int> widths(std::vector<table_column_info>
const& z)
}
return v;
}
-
-int sum(std::vector<int> z)
-{
- return std::accumulate(z.begin(), z.end(), 0);
-}
+} // Unnamed namespace.
class report_table_test
{
@@ -168,7 +171,7 @@ std::cout << "...warning message.]" << std::endl;
BOOST_TEST_THROW
(set_column_widths(total_width, default_margin, v)
,std::runtime_error
- ,"3 iterations expected, but only 0 completed."
+ ,"Not enough space for all 12 columns."
);
#endif // 0
}