Skip to content

Commit

Permalink
[SYCL][E2E] Improve debugability of user_defined_reductions.cpp test (i…
Browse files Browse the repository at this point in the history
…ntel#12312)

... by providing additional `std::ostream operator<<` overloads for
custom types used in the test.`
  • Loading branch information
aelovikov-intel authored Jan 8, 2024
1 parent dc0848d commit ea0e82b
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions sycl/test-e2e/UserDefinedReductions/user_defined_reductions.cpp
Original file line number Diff line number Diff line change
@@ -65,6 +65,11 @@ inline custom_type operator+(const custom_type &lhs, const custom_type &rhs) {
return custom_type(lhs.n.i + rhs.n.i, lhs.n.f + rhs.n.f, lhs.ull + rhs.ull);
}

inline std::ostream &operator<<(std::ostream &os, const custom_type &v) {
os << "custom_type { .n = " << v.n << ", .ull = " << v.ull << "}";
return os;
}

struct custom_type_wo_default_ctor {
static constexpr unsigned long long default_ull_value = 42;

@@ -94,6 +99,13 @@ constexpr std::array<T, sizeof...(Is)> init_array(T value,
return {{(static_cast<void>(Is), value)...}};
}

inline std::ostream &operator<<(std::ostream &os,
const custom_type_wo_default_ctor &v) {
os << "custom_type_wo_default_ctor { .n = " << v.n << ", .ull = " << v.ull
<< "}";
return os;
}

using namespace sycl;

template <typename InputContainer, typename OutputContainer,

0 comments on commit ea0e82b

Please sign in to comment.