@@ -8,9 +8,9 @@ using TestItems: @testitem
8
8
using Random
9
9
10
10
# Define operators and variable names
11
- assign_op2 = AssignOperator (; target_register= 2 )
11
+ assign_x2 = AssignOperator (; target_register= 2 )
12
12
operators = OperatorEnum (;
13
- binary_operators= [+ , - , * , / ], unary_operators= [sin, cos, assign_op2 ]
13
+ binary_operators= [+ , - , * , / ], unary_operators= [sin, cos, assign_x2 ]
14
14
)
15
15
variable_names = [" x1" , " x2" , " x3" , " x4" , " x5" ]
16
16
@@ -23,7 +23,7 @@ using TestItems: @testitem
23
23
# and then add the return to `x2` (which should now be 3.0!)
24
24
x1 = Expression (Node (; feature= 1 ); operators, variable_names)
25
25
x2 = Expression (Node (; feature= 2 ); operators, variable_names)
26
- assign_expr = assign_op2 (0.0 * x1 + 3.0 ) + x2
26
+ assign_expr = assign_x2 (0.0 * x1 + 3.0 ) + x2
27
27
28
28
@test string_tree (assign_expr) == " [x2 =]((0.0 * x1) + 3.0) + x2"
29
29
@@ -36,7 +36,7 @@ using TestItems: @testitem
36
36
@test X[2 , :] == [0.5 , 1.5 , 2.5 ]
37
37
38
38
# But, with the reverse order, we get the x2 _before_ it was reassigned
39
- assign_expr_reverse = x2 + assign_op2 (0.0 * x1 + 3.0 )
39
+ assign_expr_reverse = x2 + assign_x2 (0.0 * x1 + 3.0 )
40
40
result, completed = eval_tree_array (assign_expr_reverse, X)
41
41
@test completed == true
42
42
@test result == [3.5 , 4.5 , 5.5 ]
0 commit comments