@@ -4016,40 +4016,40 @@ TEST_CASE("Nominal", "[finance]")
4016
4016
te_parser tep;
4017
4017
4018
4018
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 ) ));
4022
4022
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)" ) )));
4026
4026
}
4027
4027
4028
4028
TEST_CASE (" Effect" , " [finance]" )
4029
4029
{
4030
4030
te_parser tep;
4031
4031
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 ) ));
4034
4034
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)" ) )));
4038
4038
}
4039
4039
4040
4040
TEST_CASE (" DB" , " [finance]" )
4041
4041
{
4042
4042
te_parser tep;
4043
4043
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 ) ));
4053
4053
4054
4054
CHECK (std::isnan (tep.evaluate (" DB(1000000,100000,6,1,0)" )));
4055
4055
CHECK (std::isnan (tep.evaluate (" DB(1000000,100000,6,1,13)" )));
0 commit comments