33 lines
739 B
Go
33 lines
739 B
Go
package nsc
|
|
|
|
import "testing"
|
|
|
|
func TestNormalizeMacOSNSCMachineTypeRoundsUp(t *testing.T) {
|
|
t.Parallel()
|
|
|
|
got, changed, err := normalizeMacOSNSCMachineType("5x10")
|
|
if err != nil {
|
|
t.Fatalf("normalizeMacOSNSCMachineType: %v", err)
|
|
}
|
|
if !changed {
|
|
t.Fatal("expected machine type to be normalized")
|
|
}
|
|
if got != "6x14" {
|
|
t.Fatalf("expected 6x14, got %q", got)
|
|
}
|
|
}
|
|
|
|
func TestNormalizeMacOSNSCMachineTypeKeepsAllowedShape(t *testing.T) {
|
|
t.Parallel()
|
|
|
|
got, changed, err := normalizeMacOSNSCMachineType("6x14")
|
|
if err != nil {
|
|
t.Fatalf("normalizeMacOSNSCMachineType: %v", err)
|
|
}
|
|
if changed {
|
|
t.Fatal("expected allowed machine type to remain unchanged")
|
|
}
|
|
if got != "6x14" {
|
|
t.Fatalf("expected 6x14, got %q", got)
|
|
}
|
|
}
|