lmi-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lmi-commits] [lmi] odd/zero_columns 9210f6e 3/3: Add a unit test for ze


From: Greg Chicares
Subject: [lmi-commits] [lmi] odd/zero_columns 9210f6e 3/3: Add a unit test for zero report columns
Date: Sun, 5 May 2019 15:29:46 -0400 (EDT)

branch: odd/zero_columns
commit 9210f6eb567f4a001b17870ea0eb5cdb23f640fd
Author: Gregory W. Chicares <address@hidden>
Commit: Gregory W. Chicares <address@hidden>

    Add a unit test for zero report columns
    
    Assume that supplying zero input columns violates no precondition.
---
 report_table.cpp      |  1 -
 report_table_test.cpp | 10 ++++++++++
 2 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/report_table.cpp b/report_table.cpp
index e5e7f63..5869867 100644
--- a/report_table.cpp
+++ b/report_table.cpp
@@ -142,7 +142,6 @@ std::vector<int> set_column_widths
             ;
         warning() << "Not enough room for even the first column." << LMI_FLUSH;
 //      alarum() << "Not enough room for even the first column." << LMI_FLUSH;
-// Add a unit test for zero columns!
         }
 
 if(0 == cardinality) warning() << __LINE__ << ' ' << __FILE__ << LMI_FLUSH;
diff --git a/report_table_test.cpp b/report_table_test.cpp
index a33d4c6..e189c90 100644
--- a/report_table_test.cpp
+++ b/report_table_test.cpp
@@ -399,6 +399,16 @@ void 
report_table_test::test_column_widths_for_illustrations()
         );
 #endif // 0
     }
+
+    // Zero columns.
+
+    {
+    std::vector<table_column_info> v {};
+    std::vector<int> const observed = set_column_widths(v, total_width, 
default_margin, 1);
+    std::vector<int> const expected {};
+    BOOST_TEST(sum(expected) < total_width);
+    BOOST_TEST(observed == expected);
+    }
 }
 
 class pagination_demo : public paginator



reply via email to

[Prev in Thread] Current Thread [Next in Thread]