Files
Satyanvesh Dittakavi 48fa72f9f4 SWDEV-460144 - Adds test with inline static variable used in different translation unit
Change-Id: I9d5c8109f7264cdf469361b983b7a940706379c2


[ROCm/hip-tests commit: aed0782ee6]
2024-07-15 14:22:26 -04:00

34 خطوط
1.6 KiB
C++

/*
Copyright (c) 2024 Advanced Micro Devices, Inc. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
// This test verifies the usage of inline constant variable in different translation units
// The inline variable is declared in MemUtils.hh, it is used in memoryCommon.cc where
// set_value and get_value are defined.
#include "MemUtils.hh"
#include "memoryCommon.hh"
using namespace mem_utils;
TEST_CASE("Unit_hipMemcpyToFromSymbol_GlobalConstVar") {
int const initialValue = 10;
set_value(initialValue);
int const finalValue = get_value();
REQUIRE(finalValue == initialValue);
}