github.com/chenzhuoyu/iasm@v0.9.1/expr/parser_test.go (about)

     1  package expr
     2  
     3  import (
     4      `testing`
     5  
     6      `github.com/stretchr/testify/assert`
     7      `github.com/stretchr/testify/require`
     8  )
     9  
    10  func TestParser_Eval(t *testing.T) {
    11      p := new(Parser).SetSource(`3 - 2 * (5 + 6) ** 4 / 7 + (1 << (1234 % 23)) & 0x5436 ^ 0x5a5a - 2 | 1`)
    12      v, err := p.Parse(nil)
    13      require.NoError(t, err)
    14      r, err := v.Evaluate()
    15      require.NoError(t, err)
    16      assert.Equal(t, int64(7805), r)
    17  }