From d211981d062e7ee681e4b4f330f11755813abeba Mon Sep 17 00:00:00 2001 From: Anton Gerasimov <anton.gerasimov@dawndata.tech> Date: Mon, 21 Jun 2021 18:00:20 +0100 Subject: [PATCH] corrected unit test --- dap-sdk/core/include/dap_math_ops.h | 3 +-- dap-sdk/core/test/math/unit_test.cpp | 29 +++++++++++++++++++++++----- 2 files changed, 25 insertions(+), 7 deletions(-) diff --git a/dap-sdk/core/include/dap_math_ops.h b/dap-sdk/core/include/dap_math_ops.h index b1e45ab6dd..707f51b04a 100755 --- a/dap-sdk/core/include/dap_math_ops.h +++ b/dap-sdk/core/include/dap_math_ops.h @@ -1,6 +1,5 @@ #pragma once #include <stdint.h> - #include "dap_common.h" #include <boost/multiprecision/cpp_int.hpp> #include <stdint.h> @@ -93,7 +92,7 @@ static inline bool dap_unsign128_t_check_equal(unsign128_t a_128_bit, unsign128_ #ifdef DAP_GLOBAL_IS_INT128 return a_128_bit == b_128_bit; #else - return a_128_bit.lo==b_128_bit.lo && a_128_bit.hi==b_128_bit; + return a_128_bit.lo==b_128_bit.lo && a_128_bit.hi==b_128_bit.hi; #endif } diff --git a/dap-sdk/core/test/math/unit_test.cpp b/dap-sdk/core/test/math/unit_test.cpp index 6e7ebf4fd8..c37afbddb5 100644 --- a/dap-sdk/core/test/math/unit_test.cpp +++ b/dap-sdk/core/test/math/unit_test.cpp @@ -39,6 +39,9 @@ int main() std::ofstream sum_256_256_file; sum_256_256_file.open ("SUM_256_256.txt"); + std::ofstream prod_64_128_file; + prod_64_128_file.open ("PROD_64_128.txt"); + uint128_t hi_64{"0xffffffffffffffff0000000000000000"}; uint128_t lo_64{"0x0000000000000000ffffffffffffffff"}; @@ -137,7 +140,7 @@ int main() // // if(boost_dap_128_prod_comparison!=boost_test_64_128_prod){ // error_counter_prod+=1;} -// + if(verbose_output==1){ @@ -204,6 +207,22 @@ int main() sum_256_256_file << (boost_dap_256_comparison)<< std::endl;} + +// if(boost_dap_256_comparison!=boost_test_256_sum){ +// +// prod_64_128_file << "boost_dap_128_prod_comparison"<< std::endl; +// +// prod_64_128_file << (boost_dap_128_prod_comparison)<< std::endl; +// +// prod_64_128_file << "boost_test_64_128_prod"<< std::endl; +// +// prod_64_128_file << (boost_test_64_128_prod)<< std::endl; +// +//} +// + + + @@ -221,10 +240,10 @@ int main() std::cout<< "SUM_256_256 returns identical results to boost:: 256 bit addition"<< std::endl;} - - if(error_counter_prod==0){ - - std::cout<< "SUM_256_256 returns identical results to boost:: 256 bit addition"<< std::endl;} +// +// if(error_counter_prod==0){ +// +// std::cout<< "SUM_256_256 returns identical results to boost:: 256 bit addition"<< std::endl;} return 0; -- GitLab