mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2024-12-22 19:19:09 +00:00
96ee2e2b2d
Currently we take int64 value from the Go parser and push it to the stack. Using uint64 is not a common practice (usually we just use `int`), but can be a problem while doing bit arithmetic and serializing numbers. Signed-off-by: Evgenii Stratonikov <fyfyrchik@runbox.com>
33 lines
409 B
Go
33 lines
409 B
Go
package compiler_test
|
|
|
|
import (
|
|
"math/big"
|
|
"testing"
|
|
)
|
|
|
|
var numericTestCases = []testCase{
|
|
{
|
|
"add",
|
|
`
|
|
package foo
|
|
func Main() int {
|
|
x := 2
|
|
y := 4
|
|
return x + y
|
|
}
|
|
`,
|
|
big.NewInt(6),
|
|
},
|
|
{
|
|
"shift uint64",
|
|
`package foo
|
|
func Main() uint64 {
|
|
return 1 << 63
|
|
}`,
|
|
new(big.Int).SetUint64(1 << 63),
|
|
},
|
|
}
|
|
|
|
func TestNumericExprs(t *testing.T) {
|
|
runTestCases(t, numericTestCases)
|
|
}
|