frostfs-node/pkg/core/netmap/epoch/relation_test.go
Stanislav Bogatyrev b7b5079934 Add Inner Ring code
2020-07-24 17:07:37 +03:00

40 lines
753 B
Go

package epoch
import (
"testing"
"github.com/stretchr/testify/require"
)
func TestEpochRelations(t *testing.T) {
items := []struct {
relFn func(Epoch, Epoch) bool
base, ok, fail uint64
}{
{relFn: EQ, base: 1, ok: 1, fail: 2},
{relFn: NE, base: 1, ok: 2, fail: 1},
{relFn: LT, base: 1, ok: 2, fail: 0},
{relFn: GT, base: 1, ok: 0, fail: 2},
{relFn: LE, base: 1, ok: 1, fail: 0},
{relFn: LE, base: 1, ok: 2, fail: 0},
{relFn: GE, base: 1, ok: 0, fail: 2},
{relFn: GE, base: 1, ok: 1, fail: 2},
}
for _, item := range items {
require.True(t,
item.relFn(
FromUint64(item.base),
FromUint64(item.ok),
),
)
require.False(t,
item.relFn(
FromUint64(item.base),
FromUint64(item.fail),
),
)
}
}