Migrate math_brute_force to the new test registration framework (#2327)

Contributes to #2181.

Signed-off-by: Ahmed Hesham <ahmed.hesham@arm.com>
This commit is contained in:
Ahmed Hesham
2025-03-18 17:25:14 +00:00
committed by GitHub
parent 11db5e5d62
commit b39eff86c5

View File

@@ -263,61 +263,112 @@ static int doTest(const char *name)
return error; return error;
} }
#define DO_TEST(name) \
REGISTER_TEST_VERSION(name, Version(1, 0)) { return doTest(#name); }
#define TEST_LAMBDA(name) \ DO_TEST(acos)
[](cl_device_id, cl_context, cl_command_queue, int) { \ DO_TEST(acosh)
return doTest(#name); \ DO_TEST(acospi)
} DO_TEST(asin)
DO_TEST(asinh)
// Redefine ADD_TEST to use TEST_LAMBDA. DO_TEST(asinpi)
#undef ADD_TEST DO_TEST(atan)
#define ADD_TEST(name) \ DO_TEST(atanh)
{ \ DO_TEST(atanpi)
TEST_LAMBDA(name), #name, Version(1, 0) \ DO_TEST(atan2)
} DO_TEST(atan2pi)
DO_TEST(cbrt)
static test_definition test_list[] = { DO_TEST(ceil)
ADD_TEST(acos), ADD_TEST(acosh), ADD_TEST(acospi), DO_TEST(copysign)
ADD_TEST(asin), ADD_TEST(asinh), ADD_TEST(asinpi), DO_TEST(cos)
ADD_TEST(atan), ADD_TEST(atanh), ADD_TEST(atanpi), DO_TEST(cosh)
ADD_TEST(atan2), ADD_TEST(atan2pi), ADD_TEST(cbrt), DO_TEST(cospi)
ADD_TEST(ceil), ADD_TEST(copysign), ADD_TEST(cos), DO_TEST(exp)
ADD_TEST(cosh), ADD_TEST(cospi), ADD_TEST(exp), DO_TEST(exp2)
ADD_TEST(exp2), ADD_TEST(exp10), ADD_TEST(expm1), DO_TEST(exp10)
ADD_TEST(fabs), ADD_TEST(fdim), ADD_TEST(floor), DO_TEST(expm1)
ADD_TEST(fma), ADD_TEST(fmax), ADD_TEST(fmin), DO_TEST(fabs)
ADD_TEST(fmod), ADD_TEST(fract), ADD_TEST(frexp), DO_TEST(fdim)
ADD_TEST(hypot), ADD_TEST(ilogb), ADD_TEST(isequal), DO_TEST(floor)
ADD_TEST(isfinite), ADD_TEST(isgreater), ADD_TEST(isgreaterequal), DO_TEST(fma)
ADD_TEST(isinf), ADD_TEST(isless), ADD_TEST(islessequal), DO_TEST(fmax)
ADD_TEST(islessgreater), ADD_TEST(isnan), ADD_TEST(isnormal), DO_TEST(fmin)
ADD_TEST(isnotequal), ADD_TEST(isordered), ADD_TEST(isunordered), DO_TEST(fmod)
ADD_TEST(ldexp), ADD_TEST(lgamma), ADD_TEST(lgamma_r), DO_TEST(fract)
ADD_TEST(log), ADD_TEST(log2), ADD_TEST(log10), DO_TEST(frexp)
ADD_TEST(log1p), ADD_TEST(logb), ADD_TEST(mad), DO_TEST(hypot)
ADD_TEST(maxmag), ADD_TEST(minmag), ADD_TEST(modf), DO_TEST(ilogb)
ADD_TEST(nan), ADD_TEST(nextafter), ADD_TEST(pow), DO_TEST(isequal)
ADD_TEST(pown), ADD_TEST(powr), ADD_TEST(remainder), DO_TEST(isfinite)
ADD_TEST(remquo), ADD_TEST(rint), ADD_TEST(rootn), DO_TEST(isgreater)
ADD_TEST(round), ADD_TEST(rsqrt), ADD_TEST(signbit), DO_TEST(isgreaterequal)
ADD_TEST(sin), ADD_TEST(sincos), ADD_TEST(sinh), DO_TEST(isinf)
ADD_TEST(sinpi), ADD_TEST(sqrt), ADD_TEST(sqrt_cr), DO_TEST(isless)
ADD_TEST(tan), ADD_TEST(tanh), ADD_TEST(tanpi), DO_TEST(islessequal)
ADD_TEST(trunc), ADD_TEST(half_cos), ADD_TEST(half_divide), DO_TEST(islessgreater)
ADD_TEST(half_exp), ADD_TEST(half_exp2), ADD_TEST(half_exp10), DO_TEST(isnan)
ADD_TEST(half_log), ADD_TEST(half_log2), ADD_TEST(half_log10), DO_TEST(isnormal)
ADD_TEST(half_powr), ADD_TEST(half_recip), ADD_TEST(half_rsqrt), DO_TEST(isnotequal)
ADD_TEST(half_sin), ADD_TEST(half_sqrt), ADD_TEST(half_tan), DO_TEST(isordered)
ADD_TEST(add), ADD_TEST(subtract), ADD_TEST(reciprocal), DO_TEST(isunordered)
ADD_TEST(divide), ADD_TEST(divide_cr), ADD_TEST(multiply), DO_TEST(ldexp)
ADD_TEST(assignment), ADD_TEST(not ), ADD_TEST(erf), DO_TEST(lgamma)
ADD_TEST(erfc), DO_TEST(lgamma_r)
}; DO_TEST(log)
DO_TEST(log2)
#undef ADD_TEST DO_TEST(log10)
#undef TEST_LAMBDA DO_TEST(log1p)
DO_TEST(logb)
static const int test_num = ARRAY_SIZE(test_list); DO_TEST(mad)
DO_TEST(maxmag)
DO_TEST(minmag)
DO_TEST(modf)
DO_TEST(nan)
DO_TEST(nextafter)
DO_TEST(pow)
DO_TEST(pown)
DO_TEST(powr)
DO_TEST(remainder)
DO_TEST(remquo)
DO_TEST(rint)
DO_TEST(rootn)
DO_TEST(round)
DO_TEST(rsqrt)
DO_TEST(signbit)
DO_TEST(sin)
DO_TEST(sincos)
DO_TEST(sinh)
DO_TEST(sinpi)
DO_TEST(sqrt)
DO_TEST(sqrt_cr)
DO_TEST(tan)
DO_TEST(tanh)
DO_TEST(tanpi)
DO_TEST(trunc)
DO_TEST(half_cos)
DO_TEST(half_divide)
DO_TEST(half_exp)
DO_TEST(half_exp2)
DO_TEST(half_exp10)
DO_TEST(half_log)
DO_TEST(half_log2)
DO_TEST(half_log10)
DO_TEST(half_powr)
DO_TEST(half_recip)
DO_TEST(half_rsqrt)
DO_TEST(half_sin)
DO_TEST(half_sqrt)
DO_TEST(half_tan)
DO_TEST(add)
DO_TEST(subtract)
DO_TEST(reciprocal)
DO_TEST(divide)
DO_TEST(divide_cr)
DO_TEST(multiply)
DO_TEST(assignment)
DO_TEST(not )
DO_TEST(erf)
DO_TEST(erfc)
#pragma mark - #pragma mark -
@@ -355,8 +406,10 @@ int main(int argc, const char *argv[])
FPU_mode_type oldMode; FPU_mode_type oldMode;
DisableFTZ(&oldMode); DisableFTZ(&oldMode);
int ret = runTestHarnessWithCheck(gTestNames.size(), gTestNames.data(), int ret = runTestHarnessWithCheck(
test_num, test_list, true, 0, InitCL); gTestNames.size(), gTestNames.data(),
test_registry::getInstance().num_tests(),
test_registry::getInstance().definitions(), true, 0, InitCL);
RestoreFPState(&oldMode); RestoreFPState(&oldMode);