#ifndef TEST_CONFORMANCE_CLCPP_MATH_FUNCS_COMPARISON_FUNCS_HPP
#define TEST_CONFORMANCE_CLCPP_MATH_FUNCS_COMPARISON_FUNCS_HPP
#include <type_traits>
#include <cmath>
#include "common.hpp"
MATH_FUNCS_DEFINE_BINARY_FUNC(comparison, fdim, std::fdim, true, 0.0f, 0.0f, 0.001f, -1000.0f, 1000.0f, -1000.0f, 1000.0f)
MATH_FUNCS_DEFINE_BINARY_FUNC(comparison, fmax, std::fmax, true, 0.0f, 0.0f, 0.001f, -1000.0f, 1000.0f, -1000.0f, 1000.0f)
MATH_FUNCS_DEFINE_BINARY_FUNC(comparison, fmin, std::fmin, true, 0.0f, 0.0f, 0.001f, -1000.0f, 1000.0f, -1000.0f, 1000.0f)
MATH_FUNCS_DEFINE_BINARY_FUNC(comparison, maxmag, reference::maxmag, true, 0.0f, 0.0f, 0.001f, -1000.0f, 1000.0f, -1000.0f, 1000.0f)
MATH_FUNCS_DEFINE_BINARY_FUNC(comparison, minmag, reference::minmag, true, 0.0f, 0.0f, 0.001f, -1000.0f, 1000.0f, -1000.0f, 1000.0f)
AUTO_TEST_CASE(test_comparison_funcs)
(cl_device_id device, cl_context context, cl_command_queue queue, int n_elems)
{
int error = CL_SUCCESS;
int last_error = CL_SUCCESS;
bool is_embedded_profile = false;
char profile[128];
last_error = clGetDeviceInfo(device, CL_DEVICE_PROFILE, sizeof(profile), (void *)&profile, NULL);
RETURN_ON_CL_ERROR(last_error, "clGetDeviceInfo")
if (std::strcmp(profile, "EMBEDDED_PROFILE") == 0)
is_embedded_profile = true;
TEST_BINARY_FUNC_MACRO((comparison_func_fdim(is_embedded_profile)))
TEST_BINARY_FUNC_MACRO((comparison_func_fmax(is_embedded_profile)))
TEST_BINARY_FUNC_MACRO((comparison_func_fmin(is_embedded_profile)))
TEST_BINARY_FUNC_MACRO((comparison_func_maxmag(is_embedded_profile)))
TEST_BINARY_FUNC_MACRO((comparison_func_minmag(is_embedded_profile)))
if(error != CL_SUCCESS)
{
return -1;
}
return error;
}
#endif