@@ -4016,40 +4016,40 @@ TEST_CASE("Nominal", "[finance]")
40164016 te_parser tep;
40174017
40184018 CHECK_THAT (4 , Catch::Matchers::WithinRel (WITHIN_TYPE_CAST (tep.evaluate (" NOMINAL(8, 2)" ))));
4019- CHECK_THAT (0.05250032 , Catch::Matchers::WithinRel (tep.evaluate (" NOMINAL(0.053543, 4)" ), 0.000001 ));
4020- CHECK_THAT (0.00995132100969354 , Catch::Matchers::WithinRel (tep.evaluate (" =NOMINAL(0.01,50)" ), 0.000001 ));
4021- CHECK_THAT (0.20744331009791 , Catch::Matchers::WithinRel (tep.evaluate (" =NOMINAL(0.23,50)" ), 0.000001 ));
4019+ CHECK_THAT (0.05250032 , Catch::Matchers::WithinRel (WITHIN_TYPE_CAST ( tep.evaluate (" NOMINAL(0.053543, 4)" )), WITHIN_TYPE_CAST ( 0.00001 ) ));
4020+ CHECK_THAT (0.00995132100969354 , Catch::Matchers::WithinRel (WITHIN_TYPE_CAST ( tep.evaluate (" =NOMINAL(0.01,50)" )), WITHIN_TYPE_CAST ( 0.00001 ) ));
4021+ CHECK_THAT (0.20744331009791 , Catch::Matchers::WithinRel (WITHIN_TYPE_CAST ( tep.evaluate (" =NOMINAL(0.23,50)" )), WITHIN_TYPE_CAST ( 0.00001 ) ));
40224022
4023- CHECK (std::isnan (tep.evaluate (" NOMINAL(8, 0)" )));
4024- CHECK (std::isnan (tep.evaluate (" NOMINAL(0, 4)" )));
4025- CHECK (std::isnan (tep.evaluate (" NOMINAL(-.1, 4)" )));
4023+ CHECK (std::isnan (WITHIN_TYPE_CAST ( tep.evaluate (" NOMINAL(8, 0)" ) )));
4024+ CHECK (std::isnan (WITHIN_TYPE_CAST ( tep.evaluate (" NOMINAL(0, 4)" ) )));
4025+ CHECK (std::isnan (WITHIN_TYPE_CAST ( tep.evaluate (" NOMINAL(-.1, 4)" ) )));
40264026 }
40274027
40284028TEST_CASE (" Effect" , " [finance]" )
40294029 {
40304030 te_parser tep;
40314031
4032- CHECK_THAT (0.0535427 , Catch::Matchers::WithinRel (tep.evaluate (" EFFECT(0.0525, 4)" ), 0.000001 ));
4033- CHECK_THAT (0.127340987166906 , Catch::Matchers::WithinRel (tep.evaluate (" EFFECT(0.12, 52)" ), 0.000001 ));
4032+ CHECK_THAT (0.0535427 , Catch::Matchers::WithinRel (WITHIN_TYPE_CAST ( tep.evaluate (" EFFECT(0.0525, 4)" )), WITHIN_TYPE_CAST ( 0.00001 ) ));
4033+ CHECK_THAT (0.127340987166906 , Catch::Matchers::WithinRel (WITHIN_TYPE_CAST ( tep.evaluate (" EFFECT(0.12, 52)" )), WITHIN_TYPE_CAST ( 0.00001 ) ));
40344034
4035- CHECK (std::isnan (tep.evaluate (" EFFECT(8, 0)" )));
4036- CHECK (std::isnan (tep.evaluate (" EFFECT(0, 4)" )));
4037- CHECK (std::isnan (tep.evaluate (" EFFECT(-.1, 4)" )));
4035+ CHECK (std::isnan (WITHIN_TYPE_CAST ( tep.evaluate (" EFFECT(8, 0)" ) )));
4036+ CHECK (std::isnan (WITHIN_TYPE_CAST ( tep.evaluate (" EFFECT(0, 4)" ) )));
4037+ CHECK (std::isnan (WITHIN_TYPE_CAST ( tep.evaluate (" EFFECT(-.1, 4)" ) )));
40384038 }
40394039
40404040TEST_CASE (" DB" , " [finance]" )
40414041 {
40424042 te_parser tep;
40434043
4044- CHECK_THAT (186083.33 , Catch::Matchers::WithinRel (tep.evaluate (" DB(1000000,100000,6,1,7)" ), 0.000001 ));
4045- CHECK_THAT (259639.42 , Catch::Matchers::WithinRel (tep.evaluate (" DB(1000000,100000,6,2,7)" ), 0.000001 ));
4046- CHECK_THAT (176814.44 , Catch::Matchers::WithinRel (tep.evaluate (" DB(1000000,100000,6,3,7)" ), 0.000001 ));
4047- CHECK_THAT (120410.64 , Catch::Matchers::WithinRel (tep.evaluate (" DB(1000000,100000,6,4,7)" ), 0.000001 ));
4048- CHECK_THAT (81999.64 , Catch::Matchers::WithinRel (tep.evaluate (" DB(1000000,100000,6,5,7)" ), 0.000001 ));
4049- CHECK_THAT (55841.76 , Catch::Matchers::WithinRel (tep.evaluate (" DB(1000000,100000,6,6,7)" ), 0.000001 ));
4050- CHECK_THAT (15845.10 , Catch::Matchers::WithinRel (tep.evaluate (" DB(1000000,100000,6,7,7)" ), 0.000001 ));
4051- CHECK_THAT (23632.18 , Catch::Matchers::WithinRel (tep.evaluate (" DB(1000000,100000,6,7,5)" ), 0.000001 ));
4052- CHECK_THAT (23632.18 , Catch::Matchers::WithinRel (tep.evaluate (" DB(1000000,100000,6,7,5.9)" ), 0.000001 ));
4044+ CHECK_THAT (186083.33 , Catch::Matchers::WithinRel (WITHIN_TYPE_CAST ( tep.evaluate (" DB(1000000,100000,6,1,7)" )), WITHIN_TYPE_CAST ( 0.00001 ) ));
4045+ CHECK_THAT (259639.42 , Catch::Matchers::WithinRel (WITHIN_TYPE_CAST ( tep.evaluate (" DB(1000000,100000,6,2,7)" )), WITHIN_TYPE_CAST ( 0.00001 ) ));
4046+ CHECK_THAT (176814.44 , Catch::Matchers::WithinRel (WITHIN_TYPE_CAST ( tep.evaluate (" DB(1000000,100000,6,3,7)" )), WITHIN_TYPE_CAST ( 0.00001 ) ));
4047+ CHECK_THAT (120410.64 , Catch::Matchers::WithinRel (WITHIN_TYPE_CAST ( tep.evaluate (" DB(1000000,100000,6,4,7)" )), WITHIN_TYPE_CAST ( 0.00001 ) ));
4048+ CHECK_THAT (81999.64 , Catch::Matchers::WithinRel (WITHIN_TYPE_CAST ( tep.evaluate (" DB(1000000,100000,6,5,7)" )), WITHIN_TYPE_CAST ( 0.00001 ) ));
4049+ CHECK_THAT (55841.76 , Catch::Matchers::WithinRel (WITHIN_TYPE_CAST ( tep.evaluate (" DB(1000000,100000,6,6,7)" )), WITHIN_TYPE_CAST ( 0.00001 ) ));
4050+ CHECK_THAT (15845.10 , Catch::Matchers::WithinRel (WITHIN_TYPE_CAST ( tep.evaluate (" DB(1000000,100000,6,7,7)" )), WITHIN_TYPE_CAST ( 0.00001 ) ));
4051+ CHECK_THAT (23632.18 , Catch::Matchers::WithinRel (WITHIN_TYPE_CAST ( tep.evaluate (" DB(1000000,100000,6,7,5)" )), WITHIN_TYPE_CAST ( 0.00001 ) ));
4052+ CHECK_THAT (23632.18 , Catch::Matchers::WithinRel (WITHIN_TYPE_CAST ( tep.evaluate (" DB(1000000,100000,6,7,5.9)" )), WITHIN_TYPE_CAST ( 0.00001 ) ));
40534053
40544054 CHECK (std::isnan (tep.evaluate (" DB(1000000,100000,6,1,0)" )));
40554055 CHECK (std::isnan (tep.evaluate (" DB(1000000,100000,6,1,13)" )));
0 commit comments