From a6aa112818b6aa748102a41d6321cd6b4abc83bf Mon Sep 17 00:00:00 2001 From: Dan Hoeflinger Date: Tue, 7 Feb 2023 10:07:13 -0500 Subject: [PATCH] formatting Signed-off-by: Dan Hoeflinger --- help_function/src/onedpl_test_null_type.cpp | 61 +++++++++------------ 1 file changed, 27 insertions(+), 34 deletions(-) diff --git a/help_function/src/onedpl_test_null_type.cpp b/help_function/src/onedpl_test_null_type.cpp index 79349786..2e80bc5c 100644 --- a/help_function/src/onedpl_test_null_type.cpp +++ b/help_function/src/onedpl_test_null_type.cpp @@ -16,53 +16,47 @@ #include -template -int ASSERT_EQUAL(String msg, _T1&& X, _T2&& Y) { - if(X!=Y) { +template +int ASSERT_EQUAL(String msg, _T1 &&X, _T2 &&Y) { + if (X != Y) { std::cout << "FAIL: " << msg << " - (" << X << "," << Y << ")" << std::endl; return 1; - } - else { + } else { std::cout << "PASS: " << msg << std::endl; return 0; } } -template -int reorder_key(KeyT& a, KeyT& b) -{ - if (b < a) - { - ::std::swap(a, b); - } - // returns 1 if reorder key is used - return 1; +template int reorder_key(KeyT &a, KeyT &b) { + if (b < a) { + ::std::swap(a, b); + } + // returns 1 if reorder key is used + return 1; } -//shows example usage of dpct::null_type, this has actual ValueT arguments +// shows example usage of dpct::null_type, this has actual ValueT arguments template -typename ::std::enable_if::value, int>::type -reorder_pair(KeyT& a_key, KeyT& b_key, ValueT& a_val, ValueT& b_val) -{ - if (b_key < a_key) - { - ::std::swap(a_key,b_key); - ::std::swap(a_val,b_val); - } - //returns 2 if reorder_pair is used - return 2; +typename ::std::enable_if::value, + int>::type +reorder_pair(KeyT &a_key, KeyT &b_key, ValueT &a_val, ValueT &b_val) { + if (b_key < a_key) { + ::std::swap(a_key, b_key); + ::std::swap(a_val, b_val); + } + // returns 2 if reorder_pair is used + return 2; } -//shows example usage of dpct::null_typeas an indicator to convert to key only +// shows example usage of dpct::null_typeas an indicator to convert to key only template -typename ::std::enable_if<::std::is_same::value, int>::type -reorder_pair(KeyT& a_key, KeyT& b_key, ValueT, ValueT) -{ - return reorder_key(a_key, b_key); +typename ::std::enable_if<::std::is_same::value, + int>::type +reorder_pair(KeyT &a_key, KeyT &b_key, ValueT, ValueT) { + return reorder_key(a_key, b_key); } int main() { - // used to detect failures int failed_tests = 0; int num_failing = 0; @@ -97,11 +91,10 @@ int main() { result = (ret == 1) && a == 3 && b == 5 && a_val == -5 && b_val == -3; test_name = "Testing null_type redirect"; failed_tests += ASSERT_EQUAL(test_name, result, true); - } - - std::cout << std::endl << failed_tests << " failing test(s) detected." << std::endl; + std::cout << std::endl + << failed_tests << " failing test(s) detected." << std::endl; if (failed_tests == 0) { return 0; }