1
0
forked from 0ad/0ad
0ad/source/lib/sysdep/win/tests/test_ia32.h
janwas 7e3265899c # fix errors in self-tests and the code they test. all now run through.
(archive_builder and compression tests are disabled ATM)

also fixed some compile warnings inside cxxtest.

refs #117

This was SVN commit r4021.
2006-06-24 10:44:08 +00:00

32 lines
757 B
C++

#include "lib/self_test.h"
#include "lib/lib.h"
#include "lib/sysdep/ia32.h"
// note: ia32_i??_from_*, ia32_rint*, ia32_fm??f are all tested within
// sysdep to avoid test duplication (both the ia32 versions and
// the portable fallback must behave the same).
class TestIA32: public CxxTest::TestSuite
{
public:
void test_rdtsc()
{
// must increase monotonously
const u64 c1 = ia32_rdtsc();
const u64 c2 = ia32_rdtsc();
const u64 c3 = ia32_rdtsc();
TS_ASSERT(c1 < c2 && c2 < c3);
}
void test_ia32_cap()
{
ia32_init();
// make sure the really common/basic caps end up reported as true
TS_ASSERT(ia32_cap(IA32_CAP_FPU));
TS_ASSERT(ia32_cap(IA32_CAP_TSC));
TS_ASSERT(ia32_cap(IA32_CAP_MMX));
}
};