mirror of
https://gitea.wildfiregames.com/0ad/0ad.git
synced 2026-07-09 13:13:30 +00:00
9542ecdd7e
refs #117 stub_impl_hack: defines a function otherwise provided by main.cpp remove old self_test.h contents (e.g. TEST); superceded by cxxtestgen TS_ASSERT etc. only include self_test from a test (otherwise, cxxtest include dir won't be set) cxxtest won't run tests named only "test"; add more descriptive name FIXES uncovered by self tests lib: infinite loop in log2 lockfree: incorrect params This was SVN commit r3979.
30 lines
739 B
C++
30 lines
739 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()
|
|
{
|
|
// 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));
|
|
}
|
|
};
|