chore: establish local platform baseline
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
package firmwareversion
|
||||
|
||||
import "testing"
|
||||
|
||||
func TestAtLeast(t *testing.T) {
|
||||
tests := []struct {
|
||||
current, minimum string
|
||||
want bool
|
||||
}{
|
||||
{"1.2.3", "1.2.3", true},
|
||||
{"v1.3.0", "1.2.9", true},
|
||||
{"1.2.3", "1.2.4", false},
|
||||
{"1.2.3", "1.2.3-rc.1", true},
|
||||
{"1.2.3-rc.2", "1.2.3-rc.1", true},
|
||||
{"1.2.3-rc.1", "1.2.3", false},
|
||||
{"0.1.0-sim", "0.1.0-sim", true},
|
||||
{"vendor-r2", "vendor-r2", true},
|
||||
{"vendor-r3", "vendor-r2", false},
|
||||
{"anything", "", true},
|
||||
}
|
||||
for _, test := range tests {
|
||||
if got := AtLeast(test.current, test.minimum); got != test.want {
|
||||
t.Errorf("AtLeast(%q,%q)=%v want %v", test.current, test.minimum, got, test.want)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user