File tree Expand file tree Collapse file tree 1 file changed +27
-1
lines changed Expand file tree Collapse file tree 1 file changed +27
-1
lines changed Original file line number Diff line number Diff line change @@ -46,7 +46,28 @@ fn calculate() {
46
46
}
47
47
48
48
#[ test]
49
- fn control ( ) {
49
+ fn variables ( ) {
50
+ let mut executor = Executor :: new ( Mode :: Script ) ;
51
+
52
+ assert_eq ! (
53
+ {
54
+ executor. evaluate_program( "5987 (x) var x" . to_string( ) ) ;
55
+ executor. pop_stack( ) . get_number( )
56
+ } ,
57
+ 5987f64
58
+ ) ;
59
+
60
+ assert_eq ! (
61
+ {
62
+ executor. evaluate_program( "5987 (x) var x 1 add (x) var x" . to_string( ) ) ;
63
+ executor. pop_stack( ) . get_number( )
64
+ } ,
65
+ 5988f64
66
+ ) ;
67
+ }
68
+
69
+ #[ test]
70
+ fn control_if ( ) {
50
71
let mut executor = Executor :: new ( Mode :: Script ) ;
51
72
52
73
assert_eq ! (
@@ -64,6 +85,11 @@ fn control() {
64
85
} ,
65
86
false
66
87
) ;
88
+ }
89
+
90
+ #[ test]
91
+ fn control_while ( ) {
92
+ let mut executor = Executor :: new ( Mode :: Script ) ;
67
93
68
94
assert_eq ! (
69
95
{
You can’t perform that action at this time.
0 commit comments