// Copyright © Advanced Micro Devices, Inc., or its affiliates. // SPDX-License-Identifier: MIT #include #include "harness/TomlGuards.hpp" using hipdnn_integration_tests::applyTomlToleranceOverride; using hipdnn_integration_tests::checkTomlSkip; using hipdnn_integration_tests::currentTestName; // NOLINTBEGIN(readability-identifier-naming) -- gtest macro-generated names // --------------------------------------------------------------------------- // currentTestName — pure gtest, no TestConfig dependency // --------------------------------------------------------------------------- TEST(TestTomlGuards, NameReturnsExpectedFormat) { const auto name = currentTestName(); EXPECT_EQ(name, "TestTomlGuards.NameReturnsExpectedFormat"); } TEST(TestTomlGuards, NameContainsDot) { const auto name = currentTestName(); EXPECT_NE(name.find('.'), std::string::npos); } // --------------------------------------------------------------------------- // checkTomlSkip / applyTomlToleranceOverride — empty-name early-return path // --------------------------------------------------------------------------- TEST(TestTomlGuards, CheckTomlSkipReturnsNulloptForEmptyName) { EXPECT_EQ(checkTomlSkip(""), std::nullopt); } TEST(TestTomlGuards, ApplyTomlToleranceOverrideReturnsFalseForEmptyName) { float atol = 1.0f; float rtol = 1.0f; EXPECT_FALSE(applyTomlToleranceOverride("", atol, rtol)); EXPECT_FLOAT_EQ(atol, 1.0f); EXPECT_FLOAT_EQ(rtol, 1.0f); } // --------------------------------------------------------------------------- // checkTomlSkip / applyTomlToleranceOverride — no TOML loaded // // TestConfig is initialized (by TestConfigInitialized in TestTestConfig.cpp, // same binary) without a settings file, so findSkipForTest / findToleranceOverride // return nullopt for any test name. // --------------------------------------------------------------------------- TEST(TestTomlGuards, CheckTomlSkipReturnsNulloptWhenNoSettings) { EXPECT_EQ(checkTomlSkip("SomeTest.Name"), std::nullopt); } TEST(TestTomlGuards, ApplyTomlToleranceOverrideReturnsFalseWhenNoSettings) { float atol = 1.0f; float rtol = 1.0f; EXPECT_FALSE(applyTomlToleranceOverride("SomeTest.Name", atol, rtol)); EXPECT_FLOAT_EQ(atol, 1.0f); EXPECT_FLOAT_EQ(rtol, 1.0f); } // NOLINTEND(readability-identifier-naming)