2021-07-02 05:41:45 +00:00
|
|
|
package version_test
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
2023-03-07 13:38:26 +00:00
|
|
|
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/core/version"
|
|
|
|
versionSDK "git.frostfs.info/TrueCloudLab/frostfs-sdk-go/version"
|
2021-07-02 05:41:45 +00:00
|
|
|
"github.com/stretchr/testify/require"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestIsValid(t *testing.T) {
|
2022-05-11 14:58:52 +00:00
|
|
|
require.True(t, version.IsValid(versionSDK.Current()))
|
2021-07-02 05:41:45 +00:00
|
|
|
|
2021-11-10 07:08:33 +00:00
|
|
|
var v versionSDK.Version
|
2021-07-02 05:41:45 +00:00
|
|
|
|
|
|
|
for _, item := range []struct {
|
|
|
|
mjr, mnr uint32
|
|
|
|
valid bool
|
|
|
|
}{
|
|
|
|
{mjr: 0, mnr: 0, valid: false},
|
|
|
|
{mjr: 2, mnr: 6, valid: false},
|
|
|
|
{mjr: 2, mnr: 7, valid: true},
|
|
|
|
{mjr: 3, mnr: 0, valid: true},
|
|
|
|
} {
|
|
|
|
v.SetMajor(item.mjr)
|
|
|
|
v.SetMinor(item.mnr)
|
|
|
|
|
|
|
|
require.Equal(t, item.valid, version.IsValid(v), item)
|
|
|
|
}
|
|
|
|
}
|