| 1 | package p11tokenscip-go gomod github.com/sassoftware/relic/v7 . `github.com/sassoftware/relic/v7/token/p11token`/ |
| 2 | |
| 3 | import ( |
| 4 | "encoding/binaryscip-go gomod github.com/golang/go/src go1.18 `encoding/binary`/" |
| 5 | "testingscip-go gomod github.com/golang/go/src go1.18 testing/" |
| 6 | |
| 7 | "github.com/stretchr/testify/assertscip-go gomod github.com/stretchr/testify v1.8.2 `github.com/stretchr/testify/assert`/" |
| 8 | ) |
| 9 | |
| 10 | func TestUlongscip-go gomod github.com/sassoftware/relic/v7 . `github.com/sassoftware/relic/v7/token/p11token`/TestUlong().(t *testingscip-go gomod github.com/golang/go/src go1.18 testing/.Tscip-go gomod github.com/golang/go/src go1.18 testing/T#) { |
| 11 | values := []uint{1, 65537, 0x12345678} |
| 12 | for _, v := range values { |
| 13 | b := make([]byte, ulongSizescip-go gomod github.com/sassoftware/relic/v7 . `github.com/sassoftware/relic/v7/token/p11token`/ulongSize.) |
| 14 | putUlongscip-go gomod github.com/sassoftware/relic/v7 . `github.com/sassoftware/relic/v7/token/p11token`/putUlong().(b, v) |
| 15 | vv, err := getUlongscip-go gomod github.com/sassoftware/relic/v7 . `github.com/sassoftware/relic/v7/token/p11token`/getUlong().(b) |
| 16 | if assertscip-go gomod github.com/stretchr/testify v1.8.2 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.8.2 `github.com/stretchr/testify/assert`/NoError().(t, err) { |
| 17 | assertscip-go gomod github.com/stretchr/testify v1.8.2 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.8.2 `github.com/stretchr/testify/assert`/Equal().(t, v, vv) |
| 18 | } |
| 19 | } |
| 20 | raw := [][]byte{ |
| 21 | []byte("a"), |
| 22 | []byte("ab"), |
| 23 | []byte("abcd"), |
| 24 | []byte("abcdefgh"), |
| 25 | } |
| 26 | var expect []uint |
| 27 | if nativeOrderscip-go gomod github.com/sassoftware/relic/v7 . `github.com/sassoftware/relic/v7/token/p11token`/nativeOrder. == binaryscip-go gomod github.com/golang/go/src go1.18 `encoding/binary`/.LittleEndianscip-go gomod github.com/golang/go/src go1.18 `encoding/binary`/LittleEndian. { |
| 28 | expect = []uint{0x61, 0x6261, 0x64636261, 0x6867666564636261} |
| 29 | } else { |
| 30 | expect = []uint{0x61, 0x6162, 0x61626364, 0x6162636465666768} |
| 31 | } |
| 32 | for i, rawv := range raw { |
| 33 | vv, err := getUlongscip-go gomod github.com/sassoftware/relic/v7 . `github.com/sassoftware/relic/v7/token/p11token`/getUlong().(rawv) |
| 34 | if assertscip-go gomod github.com/stretchr/testify v1.8.2 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.8.2 `github.com/stretchr/testify/assert`/NoError().(t, err) { |
| 35 | assertscip-go gomod github.com/stretchr/testify v1.8.2 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.8.2 `github.com/stretchr/testify/assert`/Equal().(t, expect[i], vv) |
| 36 | } |
| 37 | } |
| 38 | bad := make([]byte, 9) |
| 39 | _, err := getUlongscip-go gomod github.com/sassoftware/relic/v7 . `github.com/sassoftware/relic/v7/token/p11token`/getUlong().(bad) |
| 40 | if assertscip-go gomod github.com/stretchr/testify v1.8.2 `github.com/stretchr/testify/assert`/.Errorscip-go gomod github.com/stretchr/testify v1.8.2 `github.com/stretchr/testify/assert`/Error().(t, err) { |
| 41 | assertscip-go gomod github.com/stretchr/testify v1.8.2 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.8.2 `github.com/stretchr/testify/assert`/Equal().(t, "unable to parse value as unsigned integer: 000000000000000000", err.Error()) |
| 42 | } |
| 43 | } |