// Copyright © Advanced Micro Devices, Inc., or its affiliates. // SPDX-License-Identifier: MIT #pragma once #include #include #include #include namespace hipdnn_frontend::test { // Matcher: checks that a void* points to a value equal to `expected` template auto pointsToScalar(T expected) { return ::testing::Truly([expected](const void* ptr) { T actual; std::memcpy(&actual, ptr, sizeof(T)); return actual == expected; }); } // Matcher: checks that a void* points to a contiguous array matching `expected` template auto pointsToVector(const std::vector& expected) { return ::testing::Truly([expected](const void* ptr) { std::vector actual(expected.size()); std::memcpy(actual.data(), ptr, expected.size() * sizeof(T)); return actual == expected; }); } // Matcher: checks that a void* points to a char array matching `expected` inline auto pointsToString(const std::string& expected) { return ::testing::Truly([expected](const void* ptr) { auto actual = std::string(static_cast(ptr), expected.size()); return actual == expected; }); } } // namespace hipdnn_frontend::test