conditionals
This commit is contained in:
@@ -142,3 +142,17 @@ func TestBooleanExpressions(t *testing.T) {
|
||||
|
||||
runVmTests(t, tests)
|
||||
}
|
||||
|
||||
func TestConditionals(t *testing.T) {
|
||||
tests := []vmTestCase{
|
||||
{"if (true) { 10 }", 10},
|
||||
{"if (true) { 10 } else { 20 }", 10},
|
||||
{"if (false) { 10 } else { 20 } ", 20},
|
||||
{"if (1) { 10 }", 10},
|
||||
{"if (1 < 2) { 10 }", 10},
|
||||
{"if (1 < 2) { 10 } else { 20 }", 10},
|
||||
{"if (1 > 2) { 10 } else { 20 }", 20},
|
||||
}
|
||||
|
||||
runVmTests(t, tests)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user