1
1
#include < catch2/catch_all.hpp>
2
- #include < engine/engine.hpp>
2
+ #include " engine/engine.hpp"
3
3
#include " ExpressionFunctions.hpp"
4
4
#include " ControlFlowFunctions.hpp"
5
5
#include " LoopFunctions.hpp"
@@ -41,8 +41,7 @@ namespace nautilus::engine {
41
41
REQUIRE (f ((int8_t ) 7 ) == 14 );
42
42
REQUIRE (f ((int8_t ) -7 ) == 0 );
43
43
REQUIRE (f ((int8_t ) -14 ) == -7 );
44
- }
45
- SECTION (" castInt8ToInt64Test2" ) {
44
+ }SECTION (" castInt8ToInt64Test2" ) {
46
45
auto f = engine.registerFunction (castInt8ToInt64AddExpression2);
47
46
REQUIRE (f ((int8_t ) 8 ) == 50 );
48
47
REQUIRE (f ((int8_t ) -2 ) == 40 );
@@ -56,23 +55,29 @@ namespace nautilus::engine {
56
55
REQUIRE (f (1 ) == 43 );
57
56
}SECTION (" ifThenElseConditionTest" ) {
58
57
auto f = engine.registerFunction (ifThenElseCondition);
59
- REQUIRE (f () == 85 );
58
+ REQUIRE (f (1 ) == 85 );
59
+ REQUIRE (f (42 ) == 44 );
60
60
}SECTION (" nestedIfThenElseCondition" ) {
61
61
auto f = engine.registerFunction (nestedIfThenElseCondition);
62
- REQUIRE (f () == 5 );
62
+ REQUIRE (f (1 , 1 ) == 5 );
63
+ REQUIRE (f (42 , 1 ) == 3 );
64
+ REQUIRE (f (1 , 8 ) == 10 );
63
65
}SECTION (" nestedIfNoElseCondition" ) {
64
66
auto f = engine.registerFunction (nestedIfNoElseCondition);
65
- REQUIRE (f () == 12 );
66
- }SECTION (" andFunction" ) {
67
- auto f = engine.registerFunction (andFunction);
68
- REQUIRE (f (42 ) == true );
69
- REQUIRE (f (1 ) == false );
67
+ REQUIRE (f (1 , 1 ) == 12 );
68
+ REQUIRE (f (42 , 1 ) == 7 );
69
+ REQUIRE (f (42 , 10 ) == 16 );
70
+ REQUIRE (f (1 , -1 ) == 10 );
70
71
} SECTION (" deeplyNestedIfElseIfCondition" ) {
71
72
auto f = engine.registerFunction (deeplyNestedIfElseIfCondition);
72
73
REQUIRE (f () == 17 );
73
74
}SECTION (" deeplyNestedIfElseCondition" ) {
74
75
auto f = engine.registerFunction (deeplyNestedIfElseCondition);
75
76
REQUIRE (f () == 12 );
77
+ }SECTION (" andFunction" ) {
78
+ auto f = engine.registerFunction (andFunction);
79
+ REQUIRE (f (42 ) == true );
80
+ REQUIRE (f (1 ) == false );
76
81
}SECTION (" andCondition" ) {
77
82
auto f = engine.registerFunction (andCondition);
78
83
REQUIRE (f (42 , 42 ) == 1 );
0 commit comments