File tree Expand file tree Collapse file tree 2 files changed +50
-0
lines changed
optvm/src/test/java/com/compilerprogramming/ezlang/interpreter
registervm/src/test/java/com/compilerprogramming/ezlang/interpreter Expand file tree Collapse file tree 2 files changed +50
-0
lines changed Original file line number Diff line number Diff line change @@ -693,4 +693,29 @@ func main()->Int
693693 integerValue .value == 1 );
694694 }
695695
696+ @ Test
697+ public void testFunction108 () {
698+ String src = """
699+ func make(len: Int, val: Int)->[Int]
700+ {
701+ return new [Int]{len=len, value=val}
702+ }
703+ func main()->Int
704+ {
705+ var arr = make(3,3);
706+ var i = 0
707+ while (i < 3) {
708+ if (arr[i] != 3)
709+ return 1
710+ i = i + 1
711+ }
712+ return 0
713+ }
714+ """ ;
715+ var value = compileAndRun (src , "main" , Options .OPT );
716+ Assert .assertNotNull (value );
717+ Assert .assertTrue (value instanceof Value .IntegerValue integerValue &&
718+ integerValue .value == 0 );
719+ }
720+
696721}
Original file line number Diff line number Diff line change @@ -332,4 +332,29 @@ func main()->Int
332332 Assert .assertTrue (value instanceof Value .IntegerValue integerValue &&
333333 integerValue .value == 1 );
334334 }
335+
336+ @ Test
337+ public void testFunction108 () {
338+ String src = """
339+ func make(len: Int, val: Int)->[Int]
340+ {
341+ return new [Int]{len=len, value=val}
342+ }
343+ func main()->Int
344+ {
345+ var arr = make(3,3);
346+ var i = 0
347+ while (i < 3) {
348+ if (arr[i] != 3)
349+ return 1
350+ i = i + 1
351+ }
352+ return 0
353+ }
354+ """ ;
355+ var value = compileAndRun (src , "main" );
356+ Assert .assertNotNull (value );
357+ Assert .assertTrue (value instanceof Value .IntegerValue integerValue &&
358+ integerValue .value == 0 );
359+ }
335360}
You can’t perform that action at this time.
0 commit comments