github.com/nspcc-dev/neo-go@v0.105.2-0.20240517133400-6be757af3eba/pkg/compiler/limit_test.go (about)

     1  package compiler_test
     2  
     3  import (
     4  	"bytes"
     5  	"fmt"
     6  	"math/big"
     7  	"testing"
     8  )
     9  
    10  // Test for #605, #623.
    11  // Codegen should emit integers in proper format.
    12  func TestManyVariables(t *testing.T) {
    13  	// any number with MSB=1 is suitable
    14  	// 155 was in the contract where this bug was first found.
    15  	const count = 155
    16  
    17  	buf := bytes.NewBufferString("package main\n")
    18  	for i := 0; i < count; i++ {
    19  		buf.WriteString(fmt.Sprintf("var a%d = %d\n", i, i))
    20  	}
    21  	buf.WriteString("func Main() int {\nreturn 7\n}\n")
    22  
    23  	src := buf.String()
    24  
    25  	eval(t, src, big.NewInt(7))
    26  }