diff --git a/omnn/math/test/logic.cpp b/omnn/math/test/logic.cpp index 9a1407cbb..605a57b28 100644 --- a/omnn/math/test/logic.cpp +++ b/omnn/math/test/logic.cpp @@ -96,6 +96,56 @@ BOOST_AUTO_TEST_CASE(LessOrEqual_operator_test) { } } +BOOST_AUTO_TEST_CASE(Less_operator_test + , *disabled() // FIXME: +) { + DECL_VARS(X, Y); + auto LE = X.Less(Y); + std::cout << "X -10;) { + for (auto y = 10; y--> -10;) { + auto isLess = x < y; + auto lessOperatorInstantiation = LE; + Valuable::vars_cont_t evalMap = {{X, x}, {Y, y}}; + std::cout << '\n' << x << "<" << y << " = "; + lessOperatorInstantiation.eval(evalMap); + std::cout << " expression that must be equal to zero when true: " << lessOperatorInstantiation + << std::endl; + + lessOperatorInstantiation.optimize(); + std::cout << std::endl << "Is " << x << "<" << y << " : " << lessOperatorInstantiation << std::endl; + bool b = {}; + auto boolLessOp = lessOperatorInstantiation.ToBool(); + BOOST_TEST(boolLessOp == isLess); + boolLessOp.eval(evalMap); + BOOST_TEST(boolLessOp == isLess); + if (boolLessOp == true) { + BOOST_TEST(boolLessOp.IsInt()); + BOOST_TEST(lessOperatorInstantiation.IsInt()); + b = lessOperatorInstantiation.IsInt() && lessOperatorInstantiation.ca() == 0; + std::cout << std::endl << x << "<" << y << " : " << b << std::endl; + } else if (boolLessOp == false) { + BOOST_TEST(boolLessOrEqualOp.IsInt()); + b = lessOperatorInstantiation == 0; + std::cout << std::endl + << x << "<" << y << " : " << (b ? "true; " : "false; ") + << lessOperatorInstantiation << " != 0" << std::endl; + } else { + std::cout << std::endl << x << "<" << y << " : " << boolLessOp << std::endl; + BOOST_TEST(!"boolLessOp must have boolean value"); + } + BOOST_TEST(boolLessOrEqualOp == b); + + auto ok = b == isLess; + if (!ok) { + std::cout << "X=" << x << " Y=" << y << ' ' << ok << " bool: " << b << std::endl; + BOOST_TEST(ok); + } + } + } +} + + BOOST_AUTO_TEST_CASE(Delta_function_test , *disabled() // FIXME: ) { // https://en.wikipedia.org/wiki/Dirac_delta_function @@ -152,9 +202,9 @@ BOOST_AUTO_TEST_CASE(ifz_tests) { } } -BOOST_AUTO_TEST_CASE(Less_operator_test - , *disabled() // FIXME: -) { +BOOST_AUTO_TEST_CASE(Less_cmp_test + , *disabled() // FIXME: +){ DECL_VARS(X, Y); auto Less = X.Less(Y); std::cout << "X