@@ -238,6 +238,56 @@ BOOST_AUTO_TEST_CASE(LessOrEqual_operator_test) {
238238 }
239239}
240240
241+ BOOST_AUTO_TEST_CASE (Less_operator_test
242+ , *disabled () // FIXME:
243+ ) {
244+ DECL_VARS (X, Y);
245+ auto LE = X.Less (Y);
246+ std::cout << " X<Y : " << LE << std::endl;
247+ for (auto x = 10 ; x--> -10 ;) {
248+ for (auto y = 10 ; y--> -10 ;) {
249+ auto isLess = x < y;
250+ auto lessOperatorInstantiation = LE;
251+ Valuable::vars_cont_t evalMap = {{X, x}, {Y, y}};
252+ std::cout << ' \n ' << x << " <" << y << " = " ;
253+ lessOperatorInstantiation.eval (evalMap);
254+ std::cout << " expression that must be equal to zero when true: " << lessOperatorInstantiation
255+ << std::endl;
256+
257+ lessOperatorInstantiation.optimize ();
258+ std::cout << std::endl << " Is " << x << " <" << y << " : " << lessOperatorInstantiation << std::endl;
259+ bool b = {};
260+ auto boolLessOp = lessOperatorInstantiation.ToBool ();
261+ BOOST_TEST (boolLessOp == isLess);
262+ boolLessOp.eval (evalMap);
263+ BOOST_TEST (boolLessOp == isLess);
264+ if (boolLessOp == true ) {
265+ BOOST_TEST (boolLessOp.IsInt ());
266+ BOOST_TEST (lessOperatorInstantiation.IsInt ());
267+ b = lessOperatorInstantiation.IsInt () && lessOperatorInstantiation.ca () == 0 ;
268+ std::cout << std::endl << x << " <" << y << " : " << b << std::endl;
269+ } else if (boolLessOp == false ) {
270+ BOOST_TEST (boolLessOrEqualOp.IsInt ());
271+ b = lessOperatorInstantiation == 0 ;
272+ std::cout << std::endl
273+ << x << " <" << y << " : " << (b ? " true; " : " false; " )
274+ << lessOperatorInstantiation << " != 0" << std::endl;
275+ } else {
276+ std::cout << std::endl << x << " <" << y << " : " << boolLessOp << std::endl;
277+ BOOST_TEST (!" boolLessOp must have boolean value" );
278+ }
279+ BOOST_TEST (boolLessOrEqualOp == b);
280+
281+ auto ok = b == isLess;
282+ if (!ok) {
283+ std::cout << " X=" << x << " Y=" << y << ' ' << ok << " bool: " << b << std::endl;
284+ BOOST_TEST (ok);
285+ }
286+ }
287+ }
288+ }
289+
290+
241291BOOST_AUTO_TEST_CASE (Delta_function_test
242292 , *disabled () // FIXME:
243293) { // https://en.wikipedia.org/wiki/Dirac_delta_function
@@ -294,9 +344,9 @@ BOOST_AUTO_TEST_CASE(ifz_tests) {
294344 }
295345}
296346
297- BOOST_AUTO_TEST_CASE (Less_operator_test
298- , *disabled () // FIXME:
299- ) {
347+ BOOST_AUTO_TEST_CASE (Less_cmp_test
348+ , *disabled () // FIXME:
349+ ){
300350 DECL_VARS (X, Y);
301351 auto Less = X.Less (Y);
302352 std::cout << " X<Y : " << Less << std::endl;
@@ -322,10 +372,10 @@ BOOST_AUTO_TEST_CASE(Less_operator_test
322372 std::cout << std::endl << x << " <" << y << " : " << b << std::endl;
323373 } else if (boolLessOp == false ) {
324374 BOOST_TEST (boolLessOp.IsInt ());
325- b = lessOperatorInstantiation == 0 ;
375+ b = lessOperatorInstantiation. IsZero () ;
326376 std::cout << std::endl
327- << x << " <" << y << " : " << b << ' ' << lessOperatorInstantiation << " != 0 "
328- << std::endl;
377+ << x << " <" << y << " : " << (b ? " true; " : " false; " )
378+ << lessOperatorInstantiation << " != 0 " << std::endl;
329379 } else {
330380 std::cout << std::endl << x << " <" << y << " : " << boolLessOp << std::endl;
331381 BOOST_TEST (!" boolLessOp must have boolean value" );
0 commit comments