diff --git a/CMakeLists.txt b/CMakeLists.txt index 4b095a8..7a1453f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,10 +1,10 @@ CMAKE_MINIMUM_REQUIRED( VERSION 3.10 ) PROJECT( cppcore ) -SET ( CPPCORE_VERSION_MAJOR 0 ) -SET ( CPPCORE_VERSION_MINOR 1 ) -SET ( CPPCORE_VERSION_PATCH 0 ) -SET ( CPPCORE_VERSION ${CPPCORE_VERSION_MAJOR}.${CPPCORE_VERSION_MINOR}.${CPPCORE_VERSION_PATCH} ) -SET ( PROJECT_VERSION "${CPPCORE_VERSION}" ) +SET( CPPCORE_VERSION_MAJOR 0 ) +SET( CPPCORE_VERSION_MINOR 1 ) +SET( CPPCORE_VERSION_PATCH 0 ) +SET( CPPCORE_VERSION ${CPPCORE_VERSION_MAJOR}.${CPPCORE_VERSION_MINOR}.${CPPCORE_VERSION_PATCH} ) +SET( PROJECT_VERSION "${CPPCORE_VERSION}" ) find_package(GTest) @@ -17,11 +17,11 @@ option( CPPCORE_BUILD_UNITTESTS "Build unit tests." ON ) -option( CPPCORE_ASAN +option(CPPCORE_ASAN "Enable AddressSanitizer." OFF ) -option( CPPCORE_UBSAN +option(CPPCORE_UBSAN "Enable Undefined Behavior sanitizer." OFF ) @@ -38,9 +38,9 @@ link_directories( ${CMAKE_HOME_DIRECTORY}/ ) -SET( CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_HOME_DIRECTORY}/lib ) -SET( CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_HOME_DIRECTORY}/lib ) -SET( CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_HOME_DIRECTORY}/bin ) +SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_HOME_DIRECTORY}/lib ) +SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_HOME_DIRECTORY}/lib ) +SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_HOME_DIRECTORY}/bin ) if( WIN32 AND NOT CYGWIN ) set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /EHsc" ) # Force to always compile with W4 @@ -56,38 +56,39 @@ elseif ( "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" ) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wno-long-long -g -pedantic -std=c++11") endif() -IF (ASSIMP_ASAN) +IF(CPPCORE_ASAN) MESSAGE(STATUS "AddressSanitizer enabled") SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address") SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=address") ENDIF() -IF (ASSIMP_UBSAN) +IF(CPPCORE_UBSAN) MESSAGE(STATUS "Undefined Behavior sanitizer enabled") - SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=undefined -fno-sanitize-recover=all") - SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=undefined -fno-sanitize-recover=all") + SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=undefined -fno-sanitize-recover=all") + SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=undefined -fno-sanitize-recover=all") ENDIF() -SET ( cppcore_src +SET(cppcore_src code/cppcore.cpp include/cppcore/CPPCoreCommon.h ) -SET ( cppcore_common_src +SET(cppcore_common_src include/cppcore/Common/Hash.h include/cppcore/Common/TStringBase.h + include/cppcore/Common/TStringView.h include/cppcore/Common/Variant.h include/cppcore/Common/Sort.h include/cppcore/Common/TBitField.h include/cppcore/Common/TOptional.h ) -SET( cppcore_random_src +SET(cppcore_random_src include/cppcore/Random/RandomGenerator.h code/Random/RandomGenerator.cpp ) -SET ( cppcore_container_src +SET(cppcore_container_src include/cppcore/Container/THashMap.h include/cppcore/Container/TArray.h include/cppcore/Container/TStaticArray.h @@ -96,7 +97,7 @@ SET ( cppcore_container_src include/cppcore/Container/TStaticArray.h ) - SET ( cppcore_memory_src + SET(cppcore_memory_src include/cppcore/Memory/MemUtils.h include/cppcore/Memory/TDefaultAllocator.h include/cppcore/Memory/TStackAllocator.h @@ -137,6 +138,8 @@ IF( CPPCORE_BUILD_UNITTESTS ) test/common/SortTest.cpp test/common/TBitFieldTest.cpp test/common/TOptionalTest.cpp + test/common/TStringViewTest.cpp + test/common/TStringBaseTest.cpp ) SET( cppcore_container_test_src diff --git a/include/cppcore/CPPCoreCommon.h b/include/cppcore/CPPCoreCommon.h index 613c8e6..a37d753 100644 --- a/include/cppcore/CPPCoreCommon.h +++ b/include/cppcore/CPPCoreCommon.h @@ -45,19 +45,19 @@ namespace cppcore { #endif #ifdef CPPCORE_WINDOWS -# define CPPCORE_TAG_DLL_EXPORT __declspec(dllexport) -# define CPPCORE_TAG_DLL_IMPORT __declspec(dllimport ) +# define CPPCORE_TAG_DLL_EXPORT __declspec(dllexport) +# define CPPCORE_TAG_DLL_IMPORT __declspec(dllimport ) # ifdef CPPCORE_BUILD -# define DLL_CPPCORE_EXPORT CPPCORE_TAG_DLL_EXPORT +# define DLL_CPPCORE_EXPORT CPPCORE_TAG_DLL_EXPORT # else -# define DLL_CPPCORE_EXPORT CPPCORE_TAG_DLL_IMPORT +# define DLL_CPPCORE_EXPORT CPPCORE_TAG_DLL_IMPORT # endif // All disabled warnings for windows # pragma warning( disable : 4251 ) // needs to have dll-interface to be used by clients of class -# define CPPCORE_STACK_ALLOC(size) ::alloca(size) +# define CPPCORE_STACK_ALLOC(size) ::alloca(size) #else -# define DLL_CPPCORE_EXPORT __attribute__((visibility("default"))) -# define CPPCORE_STACK_ALLOC(size) __builtin_alloca(size) +# define DLL_CPPCORE_EXPORT __attribute__((visibility("default"))) +# define CPPCORE_STACK_ALLOC(size) __builtin_alloca(size) #endif //------------------------------------------------------------------------------------------------- @@ -107,4 +107,6 @@ public: \ //------------------------------------------------------------------------------------------------- #define CPPCORE_ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) +using HashId = uint64_t; + } // Namespace cppcore diff --git a/include/cppcore/Common/Sort.h b/include/cppcore/Common/Sort.h index e90f7ca..ed19445 100644 --- a/include/cppcore/Common/Sort.h +++ b/include/cppcore/Common/Sort.h @@ -177,7 +177,7 @@ namespace cppcore { } /// @brief Implements a binary search algorithm. - /// @tparam T The type of the value + /// @tparam T The type of the value /// @param key The key to search for /// @param array The data to search in /// @param num The number of elements to search diff --git a/include/cppcore/Common/TStringBase.h b/include/cppcore/Common/TStringBase.h index c6cce64..bd78c9d 100644 --- a/include/cppcore/Common/TStringBase.h +++ b/include/cppcore/Common/TStringBase.h @@ -23,30 +23,11 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #pragma once #include "string.h" +#include #include -#include namespace cppcore { -template -struct Allocator { - inline T *alloc(size_t size, size_t alignment) { - return (T*) _aligned_malloc(size, alignment); - } - - inline void dealloc(T *ptr) { - _aligned_free(ptr); - } - - inline static size_t countChars(const T *ptr) { - if (nullptr != ptr) { - return 0; - } - - return (::strlen(ptr)); - } -}; - //------------------------------------------------------------------------------------------------- /// @class TStringBase /// @ingroup CPPCore @@ -57,135 +38,163 @@ template class TStringBase { public: /// @brief The default class constructor. - TStringBase() noexcept; + TStringBase() noexcept = default; /// @brief The class constructor with a pointer showing to the data buffer. /// @param pPtr [in] The data buffer. - TStringBase(const T *pPtr); + TStringBase(const T *pPtr, size_t size); /// @brief The class destructor. ~TStringBase(); - void set(const T *ptr); + void set(const T *ptr, size_t size); + void clear(); + void reset(); + size_t size() const; + void resize(size_t size); + size_t capacity() const; + const T *c_str() const; + void append(const T *ptr, size_t size); /// @brief Helper method to copy data into the string. /// @param base [inout] The string data to copy in. /// @param pPtr [in] The data source. - static void copyFrom(TStringBase &base, const T *pPtr); + static void copyFrom(TStringBase &base, const T *pPtr, size_t size); bool operator == (const TStringBase &rhs) const; bool operator != (const TStringBase &rhs) const; - T *m_pStringBuffer; - size_t m_size; - size_t m_capacity; - Allocator mAllocator; +private: + static constexpr size_t InitSize = 256; + T mBuffer[InitSize] = {}; + T *mStringBuffer{nullptr}; + size_t mSize{0}; + size_t mCapacity{256}; + HashId mHashId{0}; }; template -inline TStringBase::TStringBase() noexcept : - m_pStringBuffer(nullptr), - m_size(0), - m_capacity(0), - mAllocator() { - // empty +inline TStringBase::TStringBase(const T *pPtr, size_t size) { + copyFrom(*this, pPtr, size); + mHashId = THash::toHash(pPtr, mSize); } template -inline TStringBase::TStringBase(const T *pPtr) : - m_pStringBuffer(nullptr), - m_size(0), - m_capacity(0), - mAllocator() { - copyFrom(*this, pPtr); +inline TStringBase::~TStringBase() { + clear(); } template -inline TStringBase::~TStringBase() { - if (m_pStringBuffer) { - mAllocator.dealloc(m_pStringBuffer); - m_pStringBuffer = nullptr; +inline void TStringBase::set(const T *ptr, size_t size) { + reset(); + if (nullptr != ptr) { + copyFrom(*this, ptr, size); } } template -inline void TStringBase::set(const T *ptr) { - mAllocator.dealloc(m_pStringBuffer); - if (nullptr != ptr) { - copyFrom(*this, ptr); - } +inline void TStringBase::reset() { + mSize = 0u; + mHashId = 0; } template -inline void TStringBase::copyFrom(TStringBase &base, const T *ptr) { - if (nullptr != ptr) { - base.m_size = Allocator::countChars(ptr); - if (base.m_size) { - base.m_capacity = base.m_size + 1; - base.m_pStringBuffer = base.mAllocator.alloc(base.m_capacity, 16); -#ifdef CPPCORE_WINDOWS - ::strncpy_s(base.m_pStringBuffer, base.m_capacity, ptr, base.m_size); -#else - ::strncpy(base.m_pStringBuffer, ptr, base.m_size); -#endif - base.m_pStringBuffer[base.m_size] = '\0'; - } - } +inline size_t TStringBase::size() const { + return mSize; } template -inline bool TStringBase::operator==( const TStringBase &rhs ) const { - if (rhs.m_size != m_size) { - return false; +inline void TStringBase::resize(size_t size) { + if (size <= mCapacity) { + return; } - for (size_t i = 0; i < m_size; ++i) { - if (rhs.m_pStringBuffer[i] != m_pStringBuffer[i]) { - return false; + if (mStringBuffer == nullptr) { + mStringBuffer = new T[size]; + mCapacity = size; + if (mSize > 0) { + memcpy(mStringBuffer, mBuffer, size()); } + } else { + T *ptr = new T[size]; + mCapacity = size; + if (mSize > 0) { + memcpy(ptr, mBuffer, size()); + } + mStringBuffer = ptr } +} - return true; +template +inline size_t TStringBase::capacity() const { + return mCapacity; } template -inline bool TStringBase::operator!=(const TStringBase &rhs) const { - return !(*this == rhs); +inline const T *TStringBase::c_str() const { + if (mStringBuffer != nullptr) { + return mStringBuffer; + } + + return mBuffer; } - template -class TStringView { -public: - TStringView(TCharType *ptr); - ~TStringView(); - size_t size() const; - TCharType *data() const; +template +inline void TStringBase::append(const T* ptr, size_t size) { + if (ptr == nullptr) { + return; + } -private: - TCharType *mPtr; - size_t mLen; -}; + size_t newLen = mSize + size; + if (newLen > mCapacity) { + + } +} -template -inline TStringView::TStringView(TCharType *ptr) : - mPtr(ptr), - mLen(0) { - if (nullptr != mPtr) { - mLen = strlen(ptr); +template +inline void TStringBase::clear() { + if (mStringBuffer != nullptr) { + delete [] mStringBuffer; + mStringBuffer = nullptr; + mCapacity = InitSize; } + reset(); } -template -inline TStringView::~TStringView() { - // empty +template +inline void TStringBase::copyFrom(TStringBase &base, const T *ptr, size_t size) { + if (ptr != nullptr) { + T *targetPtr = base.mBuffer; + + if (size > 0) { + if (size > base.mCapacity) { + base.mStringBuffer = new T[size]; + base.mCapacity = size; + targetPtr = base.mStringBuffer; + } + memcpy(targetPtr, ptr, size); + base.mSize = size; + } + } } -template -inline size_t TStringView::size() const { - return mLen; +template +inline bool TStringBase::operator == (const TStringBase &rhs) const { + if (rhs.mSize != mSize) { + return false; + } + + if (mHashId != rhs.mHashId) { + return false; + } + + // Fallback to actual comparison in case of hash collision + return memcmp(c_str(), rhs.c_str(), mSize * sizeof(T)) == 0; } -template -inline TCharType *TStringView::data() const { +template +inline bool TStringBase::operator != (const TStringBase &rhs) const { + return !(*this == rhs); } +} // namespace cppcore diff --git a/include/cppcore/Common/TStringView.h b/include/cppcore/Common/TStringView.h new file mode 100644 index 0000000..2117404 --- /dev/null +++ b/include/cppcore/Common/TStringView.h @@ -0,0 +1,88 @@ +/*----------------------------------------------------------------------------------------------- +The MIT License (MIT) + +Copyright (c) 2014-2025 Kim Kulling + +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. +-----------------------------------------------------------------------------------------------*/ +#pragma once + +#include + +namespace cppcore { + +//------------------------------------------------------------------------------------------------- +/// @class TStringView +/// @ingroup CPPCore +/// +/// @brief +//------------------------------------------------------------------------------------------------- +template +class TStringView { +public: + using const_iterator = const T*; + + TStringView(const T *ptr, size_t len); + ~TStringView() = default; + size_t size() const; + const T *data() const; + bool isEmpty() const; + const_iterator begin() const; + const_iterator end() const; + +private: + const T *mPtr; + size_t mLen; +}; + +template +inline TStringView::TStringView(const T *ptr, size_t len) : + mPtr(ptr), + mLen(len) { + // empty +} + +template +inline size_t TStringView::size() const { + return mLen; +} + +template +inline const T *TStringView::data() const { + return mPtr; +} + +template +inline bool TStringView::isEmpty() const { + return mLen == 0; +} + +template +inline typename TStringView::const_iterator TStringView::begin() const { + if (isEmpty()) { + return end(); + } + return mPtr; +} + +template +inline typename TStringView::const_iterator TStringView::end() const { + return mPtr + mLen; +} + +} // namespace cppcore diff --git a/include/cppcore/Memory/MemUtils.h b/include/cppcore/Memory/MemUtils.h index 2bc9103..ffac60d 100644 --- a/include/cppcore/Memory/MemUtils.h +++ b/include/cppcore/Memory/MemUtils.h @@ -23,7 +23,6 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #pragma once #include -#include #include namespace cppcore { diff --git a/test/common/HashTest.cpp b/test/common/HashTest.cpp index dd40c9b..7d3e958 100644 --- a/test/common/HashTest.cpp +++ b/test/common/HashTest.cpp @@ -31,9 +31,6 @@ using namespace cppcore; class HashTest : public testing::Test { public: using UiHash = THash; - -protected: - // empty }; TEST_F( HashTest, CreateTest ) { diff --git a/test/common/TOptionalTest.cpp b/test/common/TOptionalTest.cpp index 980facb..c7c1b5f 100644 --- a/test/common/TOptionalTest.cpp +++ b/test/common/TOptionalTest.cpp @@ -28,7 +28,7 @@ using namespace ::cppcore; class TOptionalTest : public ::testing::Test {}; TEST_F(TOptionalTest, createInstance_success) { - constexpr int ValInt = 1; + constexpr int ValInt{1}; TOptional test_int(ValInt); EXPECT_FALSE(test_int.isInited()); @@ -36,7 +36,7 @@ TEST_F(TOptionalTest, createInstance_success) { EXPECT_TRUE(test_int.isInited()); EXPECT_EQ(test_int.value(), ValInt); - constexpr float ValFloat = 1.0f; + constexpr float ValFloat{1.0f}; TOptional test_float(ValFloat); EXPECT_FALSE(test_float.isInited()); diff --git a/test/common/TStringBaseTest.cpp b/test/common/TStringBaseTest.cpp new file mode 100644 index 0000000..af2e234 --- /dev/null +++ b/test/common/TStringBaseTest.cpp @@ -0,0 +1,49 @@ +/* +------------------------------------------------------------------------------------------------- +The MIT License (MIT) + +Copyright (c) 2014-2025 Kim Kulling + +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. +------------------------------------------------------------------------------------------------- +*/ +#include + +#include + +using namespace cppcore; + +class TStringBaseTest : public ::testing::Test {}; + +TEST_F(TStringBaseTest, createTest) { + TStringBase string_1; + string_1.set("test", 4); + TStringBase string_2("test", 4); + EXPECT_EQ(string_1, string_2); +} + +TEST_F(TStringBaseTest, setResetTest) { + TStringBase string_1; + EXPECT_EQ(string_1.size(), 0); + EXPECT_EQ(string_1.capacity(), 256); + string_1.set("test", 4); + EXPECT_EQ(string_1.size(), 4); + EXPECT_EQ(0, strncmp(string_1.c_str(), "test", 4)); + string_1.reset(); + EXPECT_EQ(string_1.size(), 0); +} diff --git a/test/common/TStringViewTest.cpp b/test/common/TStringViewTest.cpp new file mode 100644 index 0000000..ec646e3 --- /dev/null +++ b/test/common/TStringViewTest.cpp @@ -0,0 +1,52 @@ +/*----------------------------------------------------------------------------------------------- +The MIT License (MIT) + +Copyright (c) 2014-2025 Kim Kulling + +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. +-----------------------------------------------------------------------------------------------*/ +#include + +#include +#include +#include + +using namespace cppcore; + +class TStringViewTest : public ::testing::Test {}; + +TEST_F(TStringViewTest, createTest) { + using StringView = TStringView; + + StringView sv("this is a test", 14L); + auto start = sv.begin(); + auto end = sv.end(); + + size_t d = distance(start, end); + EXPECT_EQ(d, 14); +} + +TEST_F(TStringViewTest, iterateTest) { + using StringView = TStringView; + constexpr char tag[] = "this is a test"; + StringView sv(tag, 14L); + size_t i{0}; + for (auto it = sv.begin(); it != sv.end(); ++it) { + EXPECT_EQ(tag[i++], *it); + } +} diff --git a/test/container/THashMapTest.cpp b/test/container/THashMapTest.cpp index 9aba9c7..372f547 100644 --- a/test/container/THashMapTest.cpp +++ b/test/container/THashMapTest.cpp @@ -30,8 +30,8 @@ using namespace ::cppcore; class THashMapTest : public ::testing::Test {}; -TEST_F( THashMapTest, constructTest ) { - bool ok( true ); +TEST_F(THashMapTest, constructTest ) { + bool ok{ true }; try { THashMap myHashMap; } catch( ... ) { @@ -39,23 +39,23 @@ TEST_F( THashMapTest, constructTest ) { } // Assert - EXPECT_TRUE( ok ); + EXPECT_TRUE(ok); } -TEST_F( THashMapTest, clearTest ) { +TEST_F(THashMapTest, clearTest ) { THashMap myHashMap( 1 ); - myHashMap.insert( 1, 10 ); - myHashMap.insert( 2, 10 ); - myHashMap.insert( 3, 10 ); + myHashMap.insert(1, 10); + myHashMap.insert(2, 10); + myHashMap.insert(3, 10); myHashMap.clear(); - EXPECT_EQ( myHashMap.size(), 0u ); + EXPECT_EQ(myHashMap.size(), 0u); } TEST_F( THashMapTest, insertTest ) { THashMap myHashMap; - bool hasKey( true ); + bool hasKey{true}; size_t size = 0; size = myHashMap.size(); diff --git a/test/container/TQueueTest.cpp b/test/container/TQueueTest.cpp index 7072f20..39252b3 100644 --- a/test/container/TQueueTest.cpp +++ b/test/container/TQueueTest.cpp @@ -103,4 +103,3 @@ TEST_F( TQueueTest, clearTest ) { EXPECT_TRUE( f32Queue.isEmpty() ); EXPECT_EQ( 0u, f32Queue.size() ); } -