From 4268ae661b1d0603d7cdbd4a04ca9eabce60f7eb Mon Sep 17 00:00:00 2001 From: Alessandro Sidero <75628365+Alessandro624@users.noreply.github.com> Date: Tue, 15 Apr 2025 17:48:00 +0200 Subject: [PATCH] fix: inconsistency assert --- eo/src/eoRanking.h | 2 +- eo/src/eoRankingCached.h | 2 +- eo/test/t-eoRankingCached.cpp | 10 ++++------ 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/eo/src/eoRanking.h b/eo/src/eoRanking.h index a8e6b69d1..f4c10951e 100644 --- a/eo/src/eoRanking.h +++ b/eo/src/eoRanking.h @@ -48,7 +48,7 @@ public: */ eoRanking(double _p = 2.0, double _e = 1.0) : pressure(_p), exponent(_e) { - assert(1 < pressure and exponent <= 2); + assert(1 < pressure and pressure <= 2); } /* helper function: finds index in _pop of _eo, an EOT * */ diff --git a/eo/src/eoRankingCached.h b/eo/src/eoRankingCached.h index 65b8c5fce..fefa45aac 100644 --- a/eo/src/eoRankingCached.h +++ b/eo/src/eoRankingCached.h @@ -59,7 +59,7 @@ public: */ eoRankingCached(double _p = 2.0, double _e = 1.0) : pressure(_p), exponent(_e), cached_pSize(0) { - assert(1 < pressure and exponent <= 2); + assert(1 < pressure and pressure <= 2); } /* diff --git a/eo/test/t-eoRankingCached.cpp b/eo/test/t-eoRankingCached.cpp index 754623c10..33973e5ee 100644 --- a/eo/test/t-eoRankingCached.cpp +++ b/eo/test/t-eoRankingCached.cpp @@ -175,19 +175,17 @@ void test_Assertions(eoParser &parser) { // Test valid parameters (should succeed) bool valid_ok = true; - valid_ok &= testRankingConstructor(1.1, 1.0); // Valid pressure and exponent - valid_ok &= testRankingConstructor(1.1, 2.0); // Edge case valid - valid_ok &= testRankingCachedConstructor(1.1, 1.0); // Valid pressure and exponent - valid_ok &= testRankingCachedConstructor(1.1, 2.0); // Edge case valid + valid_ok &= testRankingConstructor(1.1, 1.0); // Valid pressure + valid_ok &= testRankingCachedConstructor(1.1, 1.0); // Valid pressure // Test invalid parameters (should fail) bool invalid_ok = true; invalid_ok &= !testRankingConstructor(1.0, 1.0); // pressure = 1 (invalid) invalid_ok &= !testRankingConstructor(0.5, 1.0); // pressure < 1 (invalid) - invalid_ok &= !testRankingConstructor(2.0, 2.1); // exponent > 2 (invalid) + invalid_ok &= !testRankingConstructor(2.1, 1.0); // pressure > 2 (invalid) invalid_ok &= !testRankingCachedConstructor(1.0, 1.0); // pressure = 1 (invalid) invalid_ok &= !testRankingCachedConstructor(0.5, 1.0); // pressure < 1 (invalid) - invalid_ok &= !testRankingCachedConstructor(2.5, 2.1); // exponent > 2 (invalid) + invalid_ok &= !testRankingCachedConstructor(2.1, 1.0); // pressure > 2 (invalid) if (!valid_ok) {