From 196c08a15fb04d0595ec2a9fb0827c3a1d850bcc Mon Sep 17 00:00:00 2001 From: sowle Date: Mon, 10 Apr 2023 22:15:45 +0200 Subject: [PATCH] crypto tests: minor fixes --- tests/functional_tests/crypto_tests.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/functional_tests/crypto_tests.cpp b/tests/functional_tests/crypto_tests.cpp index e8a6cad6..eafa34ed 100644 --- a/tests/functional_tests/crypto_tests.cpp +++ b/tests/functional_tests/crypto_tests.cpp @@ -473,10 +473,10 @@ uint64_t hash_64(const void* data, size_t size) static bool test_name_a ## _ ## test_name_b(); \ static test_keeper_t test_name_a ## _ ## test_name_b ## _ ## keeper(STR(COMBINE(test_name_a ## _, test_name_b)), & test_name_a ## _ ## test_name_b); \ static bool test_name_a ## _ ## test_name_b() -#define ASSERT_TRUE(expr) CHECK_AND_ASSERT_MES(expr, false, "This is not true: " #expr) -#define ASSERT_FALSE(expr) CHECK_AND_ASSERT_MES((expr) == false, false, "This is not false: " #expr) -#define ASSERT_EQ(a, b) CHECK_AND_ASSERT_MES(a == b, false, #a " != " #b "\n " << a << " != " << b) -#define ASSERT_NEQ(a, b) CHECK_AND_ASSERT_MES(a != b, false, #a " == " #b "\n " << a) +#define ASSERT_TRUE(expr) CHECK_AND_ASSERT_MES(expr, false, "This is not true: " #expr << " @ " << LOCATION_SS) +#define ASSERT_FALSE(expr) CHECK_AND_ASSERT_MES((expr) == false, false, "This is not false: " #expr << " @ " << LOCATION_SS) +#define ASSERT_EQ(a, b) CHECK_AND_ASSERT_MES(a == b, false, #a " != " #b "\n " << a << " != " << b << " @ " << LOCATION_SS) +#define ASSERT_NEQ(a, b) CHECK_AND_ASSERT_MES(a != b, false, #a " == " #b "\n " << a << " @ " << LOCATION_SS) typedef bool(*bool_func_ptr_t)(); static std::vector> g_tests; @@ -1537,14 +1537,14 @@ TEST(crypto, schnorr_sig) scalar_t a = scalar_t::random(); point_t A_pt = a * c_point_G; public_key A = A_pt.to_public_key(); - ASSERT_FALSE(generate_schnorr_sig(m, A_pt, a, ss)); + // (different behaviour in debug and release) ASSERT_FALSE(generate_schnorr_sig(m, A_pt, a, ss)); ASSERT_TRUE(generate_schnorr_sig(m, A_pt, a, ss)); ASSERT_FALSE(verify_schnorr_sig(m, A, ss)); ASSERT_TRUE(verify_schnorr_sig(m, A, ss)); A_pt = a * c_point_X; A = A_pt.to_public_key(); - ASSERT_FALSE(generate_schnorr_sig(m, A_pt, a, ss)); + // (different behaviour in debug and release) ASSERT_FALSE(generate_schnorr_sig(m, A_pt, a, ss)); ASSERT_TRUE(generate_schnorr_sig(m, A_pt, a, ss)); ASSERT_FALSE(verify_schnorr_sig(m, A, ss)); ASSERT_TRUE(verify_schnorr_sig(m, A, ss));