-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathincompatible_test.go
73 lines (56 loc) · 1.24 KB
/
incompatible_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
// Copyright (c) The M1CPU Authors
// SPDX-License-Identifier: MPL-2.0
//go:build !darwin || !arm64 || !cgo
package m1cpu
import (
"testing"
"github.com/shoenig/test/must"
)
const (
message = "m1cpu: not a darwin/arm64 system"
)
func panics(f func()) (message string) {
defer func() {
if r := recover(); r != nil {
message = r.(string)
}
}()
f()
return
}
func Test_IsAppleSilicon(t *testing.T) {
result := IsAppleSilicon()
must.False(t, result)
}
func check(t *testing.T, f func()) {
t.Helper()
result := panics(f)
must.Eq(t, result, message)
}
func Test_PCoreHz(t *testing.T) {
check(t, func() { _ = PCoreHz() })
}
func Test_ECoreHz(t *testing.T) {
check(t, func() { _ = ECoreHz() })
}
func Test_PCoreGHz(t *testing.T) {
check(t, func() { _ = PCoreGHz() })
}
func Test_ECoreGHz(t *testing.T) {
check(t, func() { _ = ECoreGHz() })
}
func Test_PCoreCount(t *testing.T) {
check(t, func() { _ = PCoreCount() })
}
func Test_ECoreCount(t *testing.T) {
check(t, func() { _ = ECoreCount() })
}
func Test_PCoreCache(t *testing.T) {
check(t, func() { _, _, _ = PCoreCache() })
}
func Test_ECoreCache(t *testing.T) {
check(t, func() { _, _, _ = ECoreCache() })
}
func Test_ModelName(t *testing.T) {
check(t, func() { _ = ModelName() })
}