lmi-commits
[Top][All Lists]
Advanced

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

[lmi-commits] [lmi] master acd2244 4/5: Further reduce dissimilarities b


From: Greg Chicares
Subject: [lmi-commits] [lmi] master acd2244 4/5: Further reduce dissimilarities between check() and analyze_errors()
Date: Thu, 26 Jan 2017 18:03:16 +0000 (UTC)

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

    Further reduce dissimilarities between check() and analyze_errors()
    
    Now the actual meaning of analyze_errors() can be understood:
     - if expected 'd' != actual numbers,  show their differences
     - if expected 'c' != actual keywords, show their differences
     - show formatted_diagnostics() iff either 'd' or 'c' mismatched
    
    It's unclear why formatted_diagnostics() should not be shown
    unconditionally. But that can be investigated later; the next
    step is to merge these two functions.
---
 input_seq_test.cpp |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/input_seq_test.cpp b/input_seq_test.cpp
index 850843d..8f171eb 100644
--- a/input_seq_test.cpp
+++ b/input_seq_test.cpp
@@ -40,7 +40,8 @@ void analyze_errors
     InputSequence seq(e, n, 90, 95, 0, 2002, 0, k, w);
 
     std::vector<double> v(seq.linear_number_representation());
-    if(v != std::vector<double>(d, d + n))
+    bool const bv = v == std::vector<double>(d, d + n);
+    if(!bv)
         {
         std::cout << "\nExpression: '" << e << '\'';
         std::cout << "\n  expected: ";
@@ -51,7 +52,8 @@ void analyze_errors
         }
 
     std::vector<std::string> s(seq.linear_keyword_representation());
-    if(nullptr != c && s != std::vector<std::string>(c, c + n))
+    bool const bs = nullptr == c || s == std::vector<std::string>(c, c + n);
+    if(!bs)
         {
         std::cout << "\nExpression: '" << e << '\'';
         std::cout << "\n  expected: ";



reply via email to

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