Skip to content

Commit a6aa112

Browse files
committed
formatting
Signed-off-by: Dan Hoeflinger <[email protected]>
1 parent d6c296a commit a6aa112

File tree

1 file changed

+27
-34
lines changed

1 file changed

+27
-34
lines changed

help_function/src/onedpl_test_null_type.cpp

Lines changed: 27 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -16,53 +16,47 @@
1616

1717
#include <iostream>
1818

19-
template<typename String, typename _T1, typename _T2>
20-
int ASSERT_EQUAL(String msg, _T1&& X, _T2&& Y) {
21-
if(X!=Y) {
19+
template <typename String, typename _T1, typename _T2>
20+
int ASSERT_EQUAL(String msg, _T1 &&X, _T2 &&Y) {
21+
if (X != Y) {
2222
std::cout << "FAIL: " << msg << " - (" << X << "," << Y << ")" << std::endl;
2323
return 1;
24-
}
25-
else {
24+
} else {
2625
std::cout << "PASS: " << msg << std::endl;
2726
return 0;
2827
}
2928
}
3029

31-
template <typename KeyT>
32-
int reorder_key(KeyT& a, KeyT& b)
33-
{
34-
if (b < a)
35-
{
36-
::std::swap(a, b);
37-
}
38-
// returns 1 if reorder key is used
39-
return 1;
30+
template <typename KeyT> int reorder_key(KeyT &a, KeyT &b) {
31+
if (b < a) {
32+
::std::swap(a, b);
33+
}
34+
// returns 1 if reorder key is used
35+
return 1;
4036
}
4137

42-
//shows example usage of dpct::null_type, this has actual ValueT arguments
38+
// shows example usage of dpct::null_type, this has actual ValueT arguments
4339
template <typename KeyT, typename ValueT>
44-
typename ::std::enable_if<!::std::is_same<ValueT,dpct::null_type>::value, int>::type
45-
reorder_pair(KeyT& a_key, KeyT& b_key, ValueT& a_val, ValueT& b_val)
46-
{
47-
if (b_key < a_key)
48-
{
49-
::std::swap(a_key,b_key);
50-
::std::swap(a_val,b_val);
51-
}
52-
//returns 2 if reorder_pair is used
53-
return 2;
40+
typename ::std::enable_if<!::std::is_same<ValueT, dpct::null_type>::value,
41+
int>::type
42+
reorder_pair(KeyT &a_key, KeyT &b_key, ValueT &a_val, ValueT &b_val) {
43+
if (b_key < a_key) {
44+
::std::swap(a_key, b_key);
45+
::std::swap(a_val, b_val);
46+
}
47+
// returns 2 if reorder_pair is used
48+
return 2;
5449
}
5550

56-
//shows example usage of dpct::null_typeas an indicator to convert to key only
51+
// shows example usage of dpct::null_typeas an indicator to convert to key only
5752
template <typename KeyT, typename ValueT>
58-
typename ::std::enable_if<::std::is_same<ValueT,dpct::null_type>::value, int>::type
59-
reorder_pair(KeyT& a_key, KeyT& b_key, ValueT, ValueT)
60-
{
61-
return reorder_key(a_key, b_key);
53+
typename ::std::enable_if<::std::is_same<ValueT, dpct::null_type>::value,
54+
int>::type
55+
reorder_pair(KeyT &a_key, KeyT &b_key, ValueT, ValueT) {
56+
return reorder_key(a_key, b_key);
6257
}
6358

6459
int main() {
65-
6660
// used to detect failures
6761
int failed_tests = 0;
6862
int num_failing = 0;
@@ -97,11 +91,10 @@ int main() {
9791
result = (ret == 1) && a == 3 && b == 5 && a_val == -5 && b_val == -3;
9892
test_name = "Testing null_type redirect";
9993
failed_tests += ASSERT_EQUAL(test_name, result, true);
100-
10194
}
10295

103-
104-
std::cout << std::endl << failed_tests << " failing test(s) detected." << std::endl;
96+
std::cout << std::endl
97+
<< failed_tests << " failing test(s) detected." << std::endl;
10598
if (failed_tests == 0) {
10699
return 0;
107100
}

0 commit comments

Comments
 (0)