MCPcopy Create free account
hub / github.com/crossoverJie/gscript / TestCompiler_CompilerFor3

Function TestCompiler_CompilerFor3

compiler_test.go:43–59  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

41 assert.Equal(t, object.GetReturnObject(), 100)
42}
43func TestCompiler_CompilerFor3(t *testing.T) {
44 script := `
45int age = 0 ;
46int sum=1;
47for(int i = 0;i<100;i++) {
48 sum=sum+1;
49 for(int i = 0;i<100;i++) {
50 age++;
51 }
52}
53return age;
54`
55 compiler := NewCompiler().Compiler(script)
56 object := compiler.(*ReturnObject)
57 fmt.Println(object.GetReturnObject())
58 assert.Equal(t, object.GetReturnObject(), 100*100)
59}
60func TestCompiler_CompilerFor2(t *testing.T) {
61 script := `
62int age = 1 ;

Callers

nothing calls this directly

Calls 3

NewCompilerFunction · 0.85
CompilerMethod · 0.80
GetReturnObjectMethod · 0.80

Tested by

no test coverage detected