func TestSSE4(t *testing.T) {
	got := cpu.sse4()
	expected := cpu.features&sse4 == sse4
	if got != expected {
		t.Fatalf("SSE4: expected %v, got %v", expected, got)
	}
	t.Log("SSE4 Support:", got)
}
TestSSE4 tests SSE4() function
package cpuid
import (
	"fmt"
	"testing"
)
func TestCPUID(t *testing.T) {
	n := maxFunctionID()
	t.Logf("Max Function:0x%x\n", n)
	n = maxExtendedFunction()
	t.Logf("Max Extended Function:0x%x\n", n)
	t.Log("Name:", cpu.brandname)
	t.Log("PhysicalCores:", cpu.physicalcores)
	t.Log("ThreadsPerCore:", cpu.threadspercore)
	t.Log("LogicalCores:", cpu.logicalcores)
	t.Log("Family", cpu.family, "Model:", cpu.model)
	t.Log("Features:", cpu.features)
	t.Log("Cacheline bytes:", cpu.cacheline)
	t.Log("L1 Instruction Cache:", cpu.cache.l1i, "bytes")
	t.Log("L1 Data Cache:", cpu.cache.l1d, "bytes")
	t.Log("L2 Cache:", cpu.cache.l2, "bytes")
	t.Log("L3 Cache:", cpu.cache.l3, "bytes")
	if cpu.sse2() {
		t.Log("We have SSE2")
	}
}
func TestDumpCPUID(t *testing.T) {
	n := int(maxFunctionID())
	for i := 0; i <= n; i++ {
		a, b, c, d := cpuidex(uint32(i), 0)
		t.Logf("CPUID %08x: %08x-%08x-%08x-%08x", i, a, b, c, d)
		ex := uint32(1)
		for {
			a2, b2, c2, d2 := cpuidex(uint32(i), ex)
			if a2 == a && b2 == b && d2 == d || ex > 50 || a2 == 0 {
				break
			}
			t.Logf("CPUID %08x: %08x-%08x-%08x-%08x", i, a2, b2, c2, d2)
			a, b, c, d = a2, b2, c2, d2
			ex++
		}
	}
	n2 := maxExtendedFunction()
	for i := uint32(0x80000000); i <= n2; i++ {
		a, b, c, d := cpuid(i)
		t.Logf("CPUID %08x: %08x-%08x-%08x-%08x", i, a, b, c, d)
	}
}
func example() {
	fmt.Println("Name:", cpu.brandname)
	fmt.Println("PhysicalCores:", cpu.physicalcores)
	fmt.Println("ThreadsPerCore:", cpu.threadspercore)
	fmt.Println("LogicalCores:", cpu.logicalcores)
	fmt.Println("Family", cpu.family, "Model:", cpu.model)
	fmt.Println("Features:", cpu.features)
	fmt.Println("Cacheline bytes:", cpu.cacheline)
	if cpu.sse() {
		fmt.Println("We have Streaming SIMD Extensions")
	}
}
func TestBrandNameZero(t *testing.T) {
	if len(cpu.brandname) > 0 {
		last := []byte(cpu.brandname[len(cpu.brandname)-1:])
		if last[0] == 0 {
			t.Fatal("last byte was zero")
		} else if last[0] == 32 {
			t.Fatal("whitespace wasn't trimmed")
		}
	}
}
func TestCmov(t *testing.T) {
	got := cpu.cmov()
	expected := cpu.features&cmov == cmov
	if got != expected {
		t.Fatalf("Cmov: expected %v, got %v", expected, got)
	}
	t.Log("CMOV Support:", got)
}
func TestAmd3dnow(t *testing.T) {
	got := cpu.amd3dnow()
	expected := cpu.features&amd3dnow == amd3dnow
	if got != expected {
		t.Fatalf("Amd3dnow: expected %v, got %v", expected, got)
	}
	t.Log("AMD3DNOW Support:", got)
}
func TestAmd3dnowExt(t *testing.T) {
	got := cpu.amd3dnowext()
	expected := cpu.features&amd3dnowext == amd3dnowext
	if got != expected {
		t.Fatalf("Amd3dnowExt: expected %v, got %v", expected, got)
	}
	t.Log("AMD3DNOWEXT Support:", got)
}
func TestMMX(t *testing.T) {
	got := cpu.mmx()
	expected := cpu.features&mmx == mmx
	if got != expected {
		t.Fatalf("MMX: expected %v, got %v", expected, got)
	}
	t.Log("MMX Support:", got)
}
func TestMMXext(t *testing.T) {
	got := cpu.mmxext()
	expected := cpu.features&mmxext == mmxext
	if got != expected {
		t.Fatalf("MMXExt: expected %v, got %v", expected, got)
	}
	t.Log("MMXEXT Support:", got)
}
func TestSSE(t *testing.T) {
	got := cpu.sse()
	expected := cpu.features&sse == sse
	if got != expected {
		t.Fatalf("SSE: expected %v, got %v", expected, got)
	}
	t.Log("SSE Support:", got)
}
func TestSSE2(t *testing.T) {
	got := cpu.sse2()
	expected := cpu.features&sse2 == sse2
	if got != expected {
		t.Fatalf("SSE2: expected %v, got %v", expected, got)
	}
	t.Log("SSE2 Support:", got)
}
func TestSSE3(t *testing.T) {
	got := cpu.sse3()
	expected := cpu.features&sse3 == sse3
	if got != expected {
		t.Fatalf("SSE3: expected %v, got %v", expected, got)
	}
	t.Log("SSE3 Support:", got)
}
func TestSSSE3(t *testing.T) {
	got := cpu.ssse3()
	expected := cpu.features&ssse3 == ssse3
	if got != expected {
		t.Fatalf("SSSE3: expected %v, got %v", expected, got)
	}
	t.Log("SSSE3 Support:", got)
}