-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathioarg_test.go
62 lines (58 loc) · 1 KB
/
ioarg_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
//
// Copyright (c) 2023 Markku Rossi
//
// All rights reserved.
//
package circuit
import (
"testing"
)
var inputSizeTests = []struct {
inputs []string
sizes []int
}{
{
inputs: []string{
"0", "f", "false", "1", "t", "true",
},
sizes: []int{
1, 1, 1, 1, 1, 1,
},
},
{
inputs: []string{
"0xdeadbeef", "255",
},
sizes: []int{
32, 8,
},
},
{
inputs: []string{
"0x0", "0x00", "0x000", "0x0000",
},
sizes: []int{
4, 8, 12, 16,
},
},
}
func TestInputSizes(t *testing.T) {
for idx, test := range inputSizeTests {
sizes, err := InputSizes(test.inputs)
if err != nil {
t.Errorf("t%v: InputSizes(%v) failed: %v", idx, test.inputs, err)
continue
}
if len(sizes) != len(test.sizes) {
t.Errorf("t%v: unexpected # of sizes: got %v, expected %v",
idx, len(sizes), len(test.sizes))
continue
}
for i := 0; i < len(sizes); i++ {
if sizes[i] != test.sizes[i] {
t.Errorf("t%v: sizes[%v]=%v, expected %v",
idx, i, sizes[i], test.sizes[i])
}
}
}
}