From a8aa3f03a28f571949f50d26d0f0c32f81619e49 Mon Sep 17 00:00:00 2001
From: Sam Yates <yates@cscs.ch>
Date: Wed, 16 Nov 2016 11:42:25 +0100
Subject: [PATCH] Bugfix/issue 82 (#83)

Fixes #80
  * Avoid ctor ambiguity by using parentheses for copy ctor invocation with `nlohmann::json` class.

Fixes #82
---
 modcc/lexer.cpp             |  2 +-
 tests/modcc/test_parser.cpp | 14 +++++++-------
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/modcc/lexer.cpp b/modcc/lexer.cpp
index b15513a9..448beb74 100644
--- a/modcc/lexer.cpp
+++ b/modcc/lexer.cpp
@@ -263,7 +263,7 @@ Token Lexer::number() {
         }
         else if(!uses_scientific_notation && (c=='e' || c=='E')) {
             if(is_numeric(current_[1]) ||
-               is_plusminus(current_[1]) && is_numeric(current_[2]))
+               (is_plusminus(current_[1]) && is_numeric(current_[2])))
             {
                 uses_scientific_notation++;
                 str += c;
diff --git a/tests/modcc/test_parser.cpp b/tests/modcc/test_parser.cpp
index ab25d942..59d085de 100644
--- a/tests/modcc/test_parser.cpp
+++ b/tests/modcc/test_parser.cpp
@@ -354,7 +354,7 @@ TEST(Parser, parse_stoich_expression) {
     for (auto& text: single_expr) {
         std::unique_ptr<StoichExpression> s;
         EXPECT_TRUE(check_parse(s, &Parser::parse_stoich_expression, text));
-        EXPECT_EQ(1, s->terms().size());
+        EXPECT_EQ(1u, s->terms().size());
     }
 
     const char* double_expr[] = {
@@ -364,7 +364,7 @@ TEST(Parser, parse_stoich_expression) {
     for (auto& text: double_expr) {
         std::unique_ptr<StoichExpression> s;
         EXPECT_TRUE(check_parse(s, &Parser::parse_stoich_expression, text));
-        EXPECT_EQ(2, s->terms().size());
+        EXPECT_EQ(2u, s->terms().size());
     }
 
     const char* other_good_expr[] = {
@@ -380,7 +380,7 @@ TEST(Parser, parse_stoich_expression) {
     {
         std::unique_ptr<StoichExpression> s;
         EXPECT_TRUE(check_parse(s, &Parser::parse_stoich_expression, check_coeff));
-        EXPECT_EQ(4, s->terms().size());
+        EXPECT_EQ(4u, s->terms().size());
         std::vector<int> confirm = {-3,2,-1,1};
         for (unsigned i = 0; i<4; ++i) {
             auto term = s->terms()[i]->is_stoich_term();
@@ -439,19 +439,19 @@ TEST(Parser, parse_conserve) {
     ASSERT_TRUE(check_parse(s, &Parser::parse_conserve_expression, text));
     EXPECT_TRUE(s->rhs()->is_number());
     ASSERT_TRUE(s->lhs()->is_stoich());
-    EXPECT_EQ(2, s->lhs()->is_stoich()->terms().size());
+    EXPECT_EQ(2u, s->lhs()->is_stoich()->terms().size());
 
     text = "CONSERVE a = 1.23e-2";
     ASSERT_TRUE(check_parse(s, &Parser::parse_conserve_expression, text));
     EXPECT_TRUE(s->rhs()->is_number());
     ASSERT_TRUE(s->lhs()->is_stoich());
-    EXPECT_EQ(1, s->lhs()->is_stoich()->terms().size());
+    EXPECT_EQ(1u, s->lhs()->is_stoich()->terms().size());
 
     text = "CONSERVE = 0";
     ASSERT_TRUE(check_parse(s, &Parser::parse_conserve_expression, text));
     EXPECT_TRUE(s->rhs()->is_number());
     ASSERT_TRUE(s->lhs()->is_stoich());
-    EXPECT_EQ(0, s->lhs()->is_stoich()->terms().size());
+    EXPECT_EQ(0u, s->lhs()->is_stoich()->terms().size());
 
     text = "CONSERVE -2a + b -c = foo*2.3-bar";
     ASSERT_TRUE(check_parse(s, &Parser::parse_conserve_expression, text));
@@ -459,7 +459,7 @@ TEST(Parser, parse_conserve) {
     ASSERT_TRUE(s->lhs()->is_stoich());
     {
         auto& terms = s->lhs()->is_stoich()->terms();
-        ASSERT_EQ(3, terms.size());
+        ASSERT_EQ(3u, terms.size());
         auto coeff = terms[0]->is_stoich_term()->coeff()->is_integer();
         ASSERT_TRUE(coeff);
         EXPECT_EQ(-2, coeff->integer_value());
-- 
GitLab