/******************************************************************************** * Copyright (c) 2025-2026 ZF Friedrichshafen AG * * This program and the accompanying materials are made available under the * terms of the Apache License Version 2.0 which is available at * https://www.apache.org/licenses/LICENSE-2.0 * * SPDX-License-Identifier: Apache-2.0 * * Contributors: * Erik Verhoeven - initial API and implementation ********************************************************************************/ #include #include #include "../../../global/process_watchdog.h" #include #if defined(_WIN32) && defined(_UNICODE) extern "C" int wmain(int argc, wchar_t* argv[]) #else extern "C" int main(int argc, char* argv[]) #endif { CProcessWatchdog watchdog; testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } TEST(MemoryManagerTest, Instantiate) { EXPECT_NE(sdv::core::GetMemMgr(), nullptr); } TEST(MemoryManagerTest, Allocate) { sdv::core::IMemoryAlloc* pAlloc = sdv::core::GetMemMgr(); ASSERT_NE(pAlloc, nullptr); sdv::pointer ptr = pAlloc->Allocate(1024 * 1024); ASSERT_TRUE(ptr); EXPECT_EQ(ptr.size(), 1024 * 1024); ptr.reset(); ASSERT_FALSE(ptr); } TEST(MemoryManagerTest, AllocateSupportFunc) { sdv::pointer ptr = sdv::core::AllocMem(1024 * 1024); ASSERT_TRUE(ptr); EXPECT_EQ(ptr.size(), 1024 * 1024); ptr.reset(); ASSERT_FALSE(ptr); } TEST(MemoryManagerTest, ReallocateSupportFunc) { sdv::pointer ptr = sdv::core::AllocMem(1024 * 1024); ASSERT_TRUE(ptr); EXPECT_EQ(ptr.size(), 1024 * 1024); ptr.resize(512 * 1024); EXPECT_EQ(ptr.size(), 512 * 1024); ptr.resize(2048 * 1024); EXPECT_EQ(ptr.size(), 2048 * 1024); ptr.reset(); ASSERT_FALSE(ptr); }