forked from ava-labs/avalanchego
-
Notifications
You must be signed in to change notification settings - Fork 0
/
config_test.go
66 lines (61 loc) · 1.19 KB
/
config_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
63
64
65
66
// Copyright (C) 2019-2023, Ava Labs, Inc. All rights reserved.
// See the file LICENSE for licensing terms.
package genesis
import (
"testing"
"github.com/stretchr/testify/require"
"github.com/ava-labs/avalanchego/ids"
)
func TestAllocationLess(t *testing.T) {
type test struct {
name string
alloc1 Allocation
alloc2 Allocation
expected bool
}
tests := []test{
{
name: "equal",
alloc1: Allocation{},
alloc2: Allocation{},
expected: false,
},
{
name: "first initial amount smaller",
alloc1: Allocation{},
alloc2: Allocation{
InitialAmount: 1,
},
expected: true,
},
{
name: "first initial amount larger",
alloc1: Allocation{
InitialAmount: 1,
},
alloc2: Allocation{},
expected: false,
},
{
name: "first bytes smaller",
alloc1: Allocation{},
alloc2: Allocation{
AVAXAddr: ids.ShortID{1},
},
expected: true,
},
{
name: "first bytes larger",
alloc1: Allocation{
AVAXAddr: ids.ShortID{1},
},
alloc2: Allocation{},
expected: false,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
require.Equal(t, tt.expected, tt.alloc1.Less(tt.alloc2))
})
}
}