X-Git-Url: https://git.josue.xyz/?a=blobdiff_plain;f=.config%2Fcoc%2Fextensions%2Fcoc-go-data%2Ftools%2Fpkg%2Fmod%2Fgolang.org%2Fx%2Fsys%40v0.0.0-20210124154548-22da62e12c0c%2Fcpu%2Fcpu_test.go;fp=.config%2Fcoc%2Fextensions%2Fcoc-go-data%2Ftools%2Fpkg%2Fmod%2Fgolang.org%2Fx%2Fsys%40v0.0.0-20210124154548-22da62e12c0c%2Fcpu%2Fcpu_test.go;h=5f7f843fe4581aed83e4245be4fbaf7867b9b0e8;hb=3c06164f15bd10aed7d66b6314764a2961a14762;hp=0000000000000000000000000000000000000000;hpb=0e9c3ceb40901f4d44981c1376cb9e23a248e006;p=dotfiles%2F.git diff --git a/.config/coc/extensions/coc-go-data/tools/pkg/mod/golang.org/x/sys@v0.0.0-20210124154548-22da62e12c0c/cpu/cpu_test.go b/.config/coc/extensions/coc-go-data/tools/pkg/mod/golang.org/x/sys@v0.0.0-20210124154548-22da62e12c0c/cpu/cpu_test.go new file mode 100644 index 00000000..5f7f843f --- /dev/null +++ b/.config/coc/extensions/coc-go-data/tools/pkg/mod/golang.org/x/sys@v0.0.0-20210124154548-22da62e12c0c/cpu/cpu_test.go @@ -0,0 +1,76 @@ +// Copyright 2018 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package cpu_test + +import ( + "runtime" + "testing" + + "golang.org/x/sys/cpu" +) + +func TestAMD64minimalFeatures(t *testing.T) { + if runtime.GOARCH == "amd64" { + if !cpu.Initialized { + t.Fatal("Initialized expected true, got false") + } + if !cpu.X86.HasSSE2 { + t.Fatal("HasSSE2 expected true, got false") + } + } +} + +func TestAVX2hasAVX(t *testing.T) { + if runtime.GOARCH == "amd64" { + if cpu.X86.HasAVX2 && !cpu.X86.HasAVX { + t.Fatal("HasAVX expected true, got false") + } + } +} + +func TestAVX512HasAVX2AndAVX(t *testing.T) { + if runtime.GOARCH == "amd64" { + if cpu.X86.HasAVX512 && !cpu.X86.HasAVX { + t.Fatal("HasAVX expected true, got false") + } + if cpu.X86.HasAVX512 && !cpu.X86.HasAVX2 { + t.Fatal("HasAVX2 expected true, got false") + } + } +} + +func TestARM64minimalFeatures(t *testing.T) { + if runtime.GOARCH != "arm64" || (runtime.GOOS == "darwin" || runtime.GOOS == "ios") { + return + } + if !cpu.ARM64.HasASIMD { + t.Fatal("HasASIMD expected true, got false") + } + if !cpu.ARM64.HasFP { + t.Fatal("HasFP expected true, got false") + } +} + +func TestMIPS64Initialized(t *testing.T) { + if runtime.GOARCH == "mips64" || runtime.GOARCH == "mips64le" { + if !cpu.Initialized { + t.Fatal("Initialized expected true, got false") + } + } +} + +// On ppc64x, the ISA bit for POWER8 should always be set on POWER8 and beyond. +func TestPPC64minimalFeatures(t *testing.T) { + // Do not run this with gccgo on ppc64, as it doesn't have POWER8 as a minimum + // requirement. + if runtime.Compiler == "gccgo" && runtime.GOARCH == "ppc64" { + t.Skip("gccgo does not require POWER8 on ppc64; skipping") + } + if runtime.GOARCH == "ppc64" || runtime.GOARCH == "ppc64le" { + if !cpu.PPC64.IsPOWER8 { + t.Fatal("IsPOWER8 expected true, got false") + } + } +}