lmi-commits
[Top][All Lists]
Advanced

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

[lmi-commits] [lmi] master 48b0fdf 1/2: Revert "Remove the latent defect


From: Greg Chicares
Subject: [lmi-commits] [lmi] master 48b0fdf 1/2: Revert "Remove the latent defect just added"
Date: Thu, 6 Sep 2018 20:59:07 -0400 (EDT)

branch: master
commit 48b0fdfef950ee6923b31b9a4625602e1ea6e233
Author: Gregory W. Chicares <address@hidden>
Commit: Gregory W. Chicares <address@hidden>

    Revert "Remove the latent defect just added"
    
    This reverts commit b518132022d0dab59226f584778973265b71e532.
    
    See:
      https://lists.nongnu.org/archive/html/lmi/2018-09/msg00000.html
---
 report_table.cpp      | 13 ++++---------
 report_table.hpp      |  4 ----
 report_table_test.cpp |  2 ++
 3 files changed, 6 insertions(+), 13 deletions(-)

diff --git a/report_table.cpp b/report_table.cpp
index a1864a9..5a55979 100644
--- a/report_table.cpp
+++ b/report_table.cpp
@@ -175,19 +175,12 @@ std::vector<int> set_column_widths
     return w;
 }
 
-bool paginator::assert_preconditions() const
-{
-    LMI_ASSERT(0 <= total_rows_);
-    LMI_ASSERT(0 <  rows_per_group_                       );
-    LMI_ASSERT(     rows_per_group_ <= max_lines_per_page_);
-    return true;
-}
+/// Preconditions: 0 <= total_rows && 0 < rows_per_group <= max_lines_per_page
 
 paginator::paginator(int total_rows, int rows_per_group, int 
max_lines_per_page)
     :total_rows_         {total_rows}
     ,rows_per_group_     {rows_per_group}
     ,max_lines_per_page_ {max_lines_per_page}
-    ,ctor_args_are_sane_ {assert_preconditions()}
     // "+ 1": blank-line separator after each group.
     ,lines_per_group_    {rows_per_group_ + 1}
     // "+ 1": no blank-line separator after the last group.
@@ -195,7 +188,9 @@ paginator::paginator(int total_rows, int rows_per_group, 
int max_lines_per_page)
     ,rows_per_page_      {rows_per_group_ * groups_per_page_}
     ,page_count_         {1}
 {
-    // Preconditions: see assert_preconditions().
+    LMI_ASSERT(0 <= total_rows_);
+    LMI_ASSERT(0 <  rows_per_group_                       );
+    LMI_ASSERT(     rows_per_group_ <= max_lines_per_page_);
 
     // If there are zero rows of data, then one empty page is wanted.
     if(0 == total_rows_)
diff --git a/report_table.hpp b/report_table.hpp
index 930f0f4..b548cf2 100644
--- a/report_table.hpp
+++ b/report_table.hpp
@@ -142,15 +142,11 @@ class LMI_SO paginator
     int page_count() const {return page_count_;}
 
   private:
-    bool assert_preconditions() const;
-
     // Ctor arguments.
     int const total_rows_;
     int const rows_per_group_;
     int const max_lines_per_page_;
 
-    bool const ctor_args_are_sane_ {false};
-
     // Internals in dependency order.
     int const lines_per_group_;
     int const groups_per_page_;
diff --git a/report_table_test.cpp b/report_table_test.cpp
index c8e3a1d..68f7e7e 100644
--- a/report_table_test.cpp
+++ b/report_table_test.cpp
@@ -440,11 +440,13 @@ void report_table_test::test_paginator()
         );
 
     // Negative number of rows per group.
+#if 0
     BOOST_TEST_THROW
         (paginator(1, -1, 1)
         ,std::runtime_error
         ,lmi_test::what_regex("^Assertion.*failed")
         );
+#endif // 0
 
     // Insufficient room to print even one group.
     BOOST_TEST_THROW



reply via email to

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