33 lines
634 B
Python
33 lines
634 B
Python
|
|
import rawcpu
|
||
|
|
|
||
|
|
|
||
|
|
def test_vendor_not_empty():
|
||
|
|
assert len(rawcpu.vendor()) > 0
|
||
|
|
|
||
|
|
|
||
|
|
def test_brand_not_empty():
|
||
|
|
assert len(rawcpu.brand()) > 0
|
||
|
|
|
||
|
|
|
||
|
|
def test_rdtsc_moves_forward():
|
||
|
|
a = rawcpu.rdtsc()
|
||
|
|
b = rawcpu.rdtsc()
|
||
|
|
assert b >= a
|
||
|
|
|
||
|
|
|
||
|
|
def test_cpuid_leaf_zero_reports_max_leaf():
|
||
|
|
eax, _ebx, _ecx, _edx = rawcpu.cpuid(0)
|
||
|
|
assert eax >= 1
|
||
|
|
|
||
|
|
|
||
|
|
def test_has_feature_sse2_true_on_any_modern_x86():
|
||
|
|
assert rawcpu.has_feature("sse2") is True
|
||
|
|
|
||
|
|
|
||
|
|
def test_has_feature_unknown_raises():
|
||
|
|
try:
|
||
|
|
rawcpu.has_feature("not-a-real-feature")
|
||
|
|
assert False, "expected ValueError"
|
||
|
|
except ValueError:
|
||
|
|
pass
|