/* * Copyright (c) Advanced Micro Devices, Inc., or its affiliates. * * SPDX-License-Identifier: MIT */ #include #include /** * @addtogroup printf printf * @{ * @ingroup PrintfTest * `int printf()` - * Method to print the content on output device. */ /** * Test Description * ------------------------ * - Sanity test for `printf(format, ...)` to check all format specifier length sub-specifiers. * * Test source * ------------------------ * - unit/printf/printfLength.cc * Test requirements * ------------------------ * - HIP_VERSION >= 5.2 */ HIP_TEST_CASE(Unit_Printf_length_Sanity_Positive) { int pcieAtomic = 0; HIP_CHECK(hipDeviceGetAttribute(&pcieAtomic, hipDeviceAttributeHostNativeAtomicSupported, 0)); if (!pcieAtomic) { HIP_SKIP_TEST(HipTest::SkipReason::kPcieAtomicUnsupported); } #if HT_NVIDIA std::string reference(R"here(-42 -42 -42 -42 -42 -42 42 52 42 52 42 52 2a 2A 2a 2A 2a 2A 123.456000 x )here"); #else std::string reference(R"here(-42 -42 -42 -42 -42 -42 42 52 42 52 42 52 2a 2A 2a 2A 2a 2A 123.456000 x 123.456000 -42 -42 -42 -42 -42 -42 0 0 42 52 42 52 42 52 0 0 )here"); #endif hip::SpawnProc proc("printfLength_exe", true); REQUIRE(0 == proc.run()); REQUIRE(proc.getOutput() == reference); } /** * End doxygen group PrintfTest. * @} */