mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2024-11-25 03:47:18 +00:00
d190b3a2e0
A while ago VM serialization format for Integer items was changed but compiler continued to emit Integers in old format. This commit changes compiler behaviour to be compatible with VM.
26 lines
548 B
Go
26 lines
548 B
Go
package compiler_test
|
|
|
|
import (
|
|
"bytes"
|
|
"fmt"
|
|
"math/big"
|
|
"testing"
|
|
)
|
|
|
|
// Test for #605, #623.
|
|
// Codegen should emit integers in proper format.
|
|
func TestManyVariables(t *testing.T) {
|
|
// any number with MSB=1 is suitable
|
|
// 155 was in the contract where this bug was first found.
|
|
const count = 155
|
|
|
|
buf := bytes.NewBufferString("package main\n")
|
|
for i := 0; i < count; i++ {
|
|
buf.WriteString(fmt.Sprintf("var a%d = %d\n", i, i))
|
|
}
|
|
buf.WriteString("func Main() int {\nreturn 7\n}\n")
|
|
|
|
src := buf.String()
|
|
|
|
eval(t, src, big.NewInt(7))
|
|
}
|