Skip to content

Commit

Permalink
[tests] Fix test compile errors for C++20 (#1567)
Browse files Browse the repository at this point in the history
  • Loading branch information
SergeyKopienko authored May 7, 2024
1 parent 3d34efa commit 456bbe5
Show file tree
Hide file tree
Showing 13 changed files with 39 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include <oneapi/dpl/type_traits>

#include "support/utils.h"
#include "support/test_macros.h"

class KernelBitAndTest;

Expand All @@ -34,9 +35,11 @@ kernel_test()
cgh.single_task<class KernelBitAndTest>([=]() {
typedef dpl::bit_and<int> F;
const F f = F();
#if TEST_STD_VER < 20
static_assert(dpl::is_same<int, F::first_argument_type>::value);
static_assert(dpl::is_same<int, F::second_argument_type>::value);
static_assert(dpl::is_same<int, F::result_type>::value);
#endif // TEST_STD_VER < 20
ret_access[0] = (f(0xEA95, 0xEA95) == 0xEA95);
ret_access[0] &= (f(0xEA95, 0x58D3) == 0x4891);
ret_access[0] &= (f(0x58D3, 0xEA95) == 0x4891);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include <oneapi/dpl/type_traits>

#include "support/utils.h"
#include "support/test_macros.h"

class KernelBitNotTest;

Expand All @@ -34,8 +35,10 @@ kernel_test()
cgh.single_task<class KernelBitNotTest>([=]() {
typedef dpl::bit_not<int> F;
const F f = F();
#if TEST_STD_VER < 20
static_assert(dpl::is_same<F::argument_type, int>::value);
static_assert(dpl::is_same<F::result_type, int>::value);
#endif // TEST_STD_VER < 20
ret_access[0] = ((f(0xEA95) & 0xFFFF) == 0x156A);
ret_access[0] &= ((f(0x58D3) & 0xFFFF) == 0xA72C);
ret_access[0] &= ((f(0) & 0xFFFF) == 0xFFFF);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include <oneapi/dpl/type_traits>

#include "support/utils.h"
#include "support/test_macros.h"

class KernelBitOrTest;

Expand All @@ -34,9 +35,11 @@ kernel_test()
cgh.single_task<class KernelBitOrTest>([=]() {
typedef dpl::bit_or<int> F;
const F f = F();
#if TEST_STD_VER < 20
static_assert(dpl::is_same<int, F::first_argument_type>::value);
static_assert(dpl::is_same<int, F::second_argument_type>::value);
static_assert(dpl::is_same<int, F::result_type>::value);
#endif // TEST_STD_VER < 20
ret_access[0] = (f(0xEA95, 0xEA95) == 0xEA95);
ret_access[0] &= (f(0xEA95, 0x58D3) == 0xFAD7);
ret_access[0] &= (f(0x58D3, 0xEA95) == 0xFAD7);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include <oneapi/dpl/type_traits>

#include "support/utils.h"
#include "support/test_macros.h"

class KernelBitXorTest;

Expand All @@ -35,9 +36,11 @@ kernel_test()
{
typedef dpl::bit_xor<int> F;
const F f = F();
#if TEST_STD_VER < 20
static_assert(dpl::is_same<int, F::first_argument_type>::value);
static_assert(dpl::is_same<int, F::second_argument_type>::value);
static_assert(dpl::is_same<int, F::result_type>::value);
#endif // TEST_STD_VER < 20
ret_access[0] = (f(0xEA95, 0xEA95) == 0);
ret_access[0] &= (f(0xEA95, 0x58D3) == 0xB246);
ret_access[0] &= (f(0x58D3, 0xEA95) == 0xB246);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include <oneapi/dpl/type_traits>

#include "support/utils.h"
#include "support/test_macros.h"

class KernelEqualToTest;

Expand All @@ -34,9 +35,11 @@ kernel_test()
cgh.single_task<class KernelEqualToTest>([=]() {
typedef dpl::equal_to<int> F;
const F f = F();
#if TEST_STD_VER < 20
static_assert(dpl::is_same<int, F::first_argument_type>::value);
static_assert(dpl::is_same<int, F::second_argument_type>::value);
static_assert(dpl::is_same<bool, F::result_type>::value);
#endif // TEST_STD_VER < 20
ret_access[0] = (f(36, 36));
ret_access[0] &= (!f(36, 6));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include <oneapi/dpl/type_traits>

#include "support/utils.h"
#include "support/test_macros.h"

class KernelGreaterTest;

Expand All @@ -34,9 +35,11 @@ kernel_test()
cgh.single_task<class KernelGreaterTest>([=]() {
typedef dpl::greater<int> F;
const F f = F();
#if TEST_STD_VER < 20
static_assert(dpl::is_same<int, F::first_argument_type>::value);
static_assert(dpl::is_same<int, F::second_argument_type>::value);
static_assert(dpl::is_same<bool, F::result_type>::value);
#endif // TEST_STD_VER < 20
ret_access[0] = (!f(36, 36));
ret_access[0] &= (f(36, 6));
ret_access[0] &= (!f(6, 36));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include <oneapi/dpl/type_traits>

#include "support/utils.h"
#include "support/test_macros.h"

class KernelGreaterEqualTest;

Expand All @@ -34,9 +35,11 @@ kernel_test()
cgh.single_task<class KernelGreaterEqualTest>([=]() {
typedef dpl::greater_equal<int> F;
const F f = F();
#if TEST_STD_VER < 20
static_assert(dpl::is_same<int, F::first_argument_type>::value);
static_assert(dpl::is_same<int, F::second_argument_type>::value);
static_assert(dpl::is_same<bool, F::result_type>::value);
#endif // TEST_STD_VER < 20
ret_access[0] = (f(36, 36));
ret_access[0] &= (f(36, 6));
ret_access[0] &= (!f(6, 36));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include <oneapi/dpl/type_traits>

#include "support/utils.h"
#include "support/test_macros.h"

class KernelLessTest;

Expand All @@ -34,9 +35,11 @@ kernel_test()
cgh.single_task<class KernelLessTest>([=]() {
typedef dpl::less<int> F;
const F f = F();
#if TEST_STD_VER < 20
static_assert(dpl::is_same<int, F::first_argument_type>::value);
static_assert(dpl::is_same<int, F::second_argument_type>::value);
static_assert(dpl::is_same<bool, F::result_type>::value);
#endif // TEST_STD_VER < 20
ret_access[0] = (!f(36, 36));
ret_access[0] &= (!f(36, 6));
ret_access[0] &= (f(6, 36));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include <oneapi/dpl/type_traits>

#include "support/utils.h"
#include "support/test_macros.h"

class KernelLessEqualTest;

Expand All @@ -34,9 +35,11 @@ kernel_test()
cgh.single_task<class KernelLessEqualTest>([=]() {
typedef dpl::less_equal<int> F;
const F f = F();
#if TEST_STD_VER < 20
static_assert(dpl::is_same<int, F::first_argument_type>::value);
static_assert(dpl::is_same<int, F::second_argument_type>::value);
static_assert(dpl::is_same<bool, F::result_type>::value);
#endif // TEST_STD_VER < 20
ret_access[0] = (f(36, 36));
ret_access[0] &= (!f(36, 6));
ret_access[0] &= (f(6, 36));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include <oneapi/dpl/type_traits>

#include "support/utils.h"
#include "support/test_macros.h"

class KernelNotEqualToTest;

Expand All @@ -34,9 +35,11 @@ kernel_test()
cgh.single_task<class KernelNotEqualToTest>([=]() {
typedef dpl::not_equal_to<int> F;
const F f = F();
#if TEST_STD_VER < 20
static_assert(dpl::is_same<int, F::first_argument_type>::value);
static_assert(dpl::is_same<int, F::second_argument_type>::value);
static_assert(dpl::is_same<bool, F::result_type>::value);
#endif // TEST_STD_VER < 20
ret_access[0] = (!f(36, 36));
ret_access[0] &= (f(36, 6));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include <oneapi/dpl/type_traits>

#include "support/utils.h"
#include "support/test_macros.h"

class KernelLogicalAndTest;

Expand All @@ -34,9 +35,11 @@ kernel_test()
cgh.single_task<class KernelLogicalAndTest>([=]() {
typedef dpl::logical_and<int> F;
const F f = F();
#if TEST_STD_VER < 20
static_assert(dpl::is_same<int, F::first_argument_type>::value);
static_assert(dpl::is_same<int, F::second_argument_type>::value);
static_assert(dpl::is_same<bool, F::result_type>::value);
#endif // TEST_STD_VER < 20
ret_access[0] = (f(36, 36));
ret_access[0] &= (!f(36, 0));
ret_access[0] &= (!f(0, 36));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include <oneapi/dpl/type_traits>

#include "support/utils.h"
#include "support/test_macros.h"

class KernelLogicalNotTest;

Expand All @@ -34,8 +35,10 @@ kernel_test()
cgh.single_task<class KernelLogicalNotTest>([=]() {
typedef dpl::logical_not<int> F;
const F f = F();
#if TEST_STD_VER < 20
static_assert(dpl::is_same<F::argument_type, int>::value);
static_assert(dpl::is_same<F::result_type, bool>::value);
#endif // TEST_STD_VER < 20
ret_access[0] = (!f(36));
ret_access[0] &= (f(0));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include <oneapi/dpl/type_traits>

#include "support/utils.h"
#include "support/test_macros.h"

class KernelLogicalOrTest;

Expand All @@ -34,9 +35,11 @@ kernel_test()
cgh.single_task<class KernelLogicalOrTest>([=]() {
typedef dpl::logical_or<int> F;
const F f = F();
#if TEST_STD_VER < 20
static_assert(dpl::is_same<int, F::first_argument_type>::value);
static_assert(dpl::is_same<int, F::second_argument_type>::value);
static_assert(dpl::is_same<bool, F::result_type>::value);
#endif // TEST_STD_VER < 20
ret_access[0] = (f(36, 36));
ret_access[0] &= (f(36, 0));
ret_access[0] &= (f(0, 36));
Expand Down

0 comments on commit 456bbe5

Please sign in to comment.