(t *testing.T)
| 11 | ) |
| 12 | |
| 13 | func TestGetMachine(t *testing.T) { |
| 14 | arch, err := system.NewSystem().GetArchitecture() |
| 15 | |
| 16 | expectedArch := func(arch string) bool { return arch == runtime.GOARCH } |
| 17 | switch runtime.GOARCH { |
| 18 | case "amd64": |
| 19 | expectedArch = func(arch string) bool { return strings.HasPrefix(arch, system.X86_64) } |
| 20 | case "386": |
| 21 | expectedArch = func(arch string) bool { return slices.Contains([]string{system.I586, system.I686}, arch) } |
| 22 | case "arm": |
| 23 | expectedArch = func(arch string) bool { return strings.HasPrefix(arch, "armv") } |
| 24 | case "arm64": |
| 25 | expectedArch = func(arch string) bool { return arch == system.AARCH64 } |
| 26 | case "loong64": |
| 27 | expectedArch = func(arch string) bool { return arch == "loongarch64" } |
| 28 | } |
| 29 | |
| 30 | if err != nil { |
| 31 | t.Error(err) |
| 32 | } |
| 33 | if !expectedArch(arch) { |
| 34 | t.Error(arch) |
| 35 | } |
| 36 | } |
| 37 | |
| 38 | func TestGetOSId(t *testing.T) { |
| 39 | sys := system.NewSystem() |
nothing calls this directly
no test coverage detected