diff --git a/CMakeLists.txt b/CMakeLists.txt index 06ba38f..4b095a8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -77,6 +77,7 @@ SET ( cppcore_common_src include/cppcore/Common/Hash.h include/cppcore/Common/TStringBase.h include/cppcore/Common/Variant.h + include/cppcore/Common/Sort.h include/cppcore/Common/TBitField.h include/cppcore/Common/TOptional.h ) @@ -133,6 +134,7 @@ IF( CPPCORE_BUILD_UNITTESTS ) SET( cppcore_common_test_src test/common/HashTest.cpp test/common/VariantTest.cpp + test/common/SortTest.cpp test/common/TBitFieldTest.cpp test/common/TOptionalTest.cpp ) diff --git a/code/cppcore.cpp b/code/cppcore.cpp index 9e9df2c..aa13166 100644 --- a/code/cppcore.cpp +++ b/code/cppcore.cpp @@ -1,7 +1,7 @@ /*----------------------------------------------------------------------------------------------- The MIT License (MIT) -Copyright (c) 2014-2024 Kim Kulling +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 diff --git a/include/cppcore/CPPCoreCommon.h b/include/cppcore/CPPCoreCommon.h index 3eeeaf8..613c8e6 100644 --- a/include/cppcore/CPPCoreCommon.h +++ b/include/cppcore/CPPCoreCommon.h @@ -29,6 +29,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include #include #include +#include namespace cppcore { @@ -53,8 +54,10 @@ namespace cppcore { # 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) #else # define DLL_CPPCORE_EXPORT __attribute__((visibility("default"))) +# define CPPCORE_STACK_ALLOC(size) __builtin_alloca(size) #endif //------------------------------------------------------------------------------------------------- diff --git a/include/cppcore/Common/Sort.h b/include/cppcore/Common/Sort.h new file mode 100644 index 0000000..fe6e9e1 --- /dev/null +++ b/include/cppcore/Common/Sort.h @@ -0,0 +1,137 @@ +/*----------------------------------------------------------------------------------------------- +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 { + + typedef int32_t (*ComparisonFn)(const void* _lhs, const void* _rhs); + + template + inline int32_t compAscending(const void *lhs, const void *rhs) { + const T _lhs = *static_cast(lhs); + const T _rhs = *static_cast(rhs); + return (_lhs > _rhs) - (_lhs < _rhs); + } + + template + inline int32_t compDescending(const void *_lhs, const void *_rhs) { + return compAscending(_rhs, _lhs); + } + + template + inline void swap(T& v1, T& v2) { + T tmp = v1; + v1 = v2; + v2 = tmp; + } + + inline void swap(uint8_t &lhs, uint8_t &rhs) { + uint8_t tmp = lhs; + lhs = rhs; + rhs = tmp; + } + + inline void swap(void *v1, void *v2, size_t stride) { + uint8_t *lhs = (uint8_t*) v1; + uint8_t *rhs = (uint8_t*) v2; + const uint8_t *end = rhs + stride; + while (rhs != end) { + swap(*lhs++, *rhs++); + } + } + + inline void quicksortImpl(void *pivot, void *_data, size_t num, size_t stride, ComparisonFn func) { + if (num < 2) { + return; + } + + if (_data == nullptr) { + return; + } + + uint8_t *data = (uint8_t*) _data; + memcpy(pivot, &data[0], stride); + + size_t l = 0; + size_t g = 1; + for (size_t i=1; i 0) { + swap(&data[l*stride], &data[i*stride], stride); + ++l; + } else if (result == 0) { + swap(&data[g*stride], &data[i*stride], stride); + ++g; + ++i; + } else { + ++i; + } + } + + quicksortImpl(pivot, &data[0], l, stride, func); + quicksortImpl(pivot, &data[g*stride], num - g, stride, func); + } + + inline void quicksort(void *_data, size_t num, size_t stride, ComparisonFn func) { + uint8_t *pivot = (uint8_t*) CPPCORE_STACK_ALLOC(stride); + quicksortImpl(pivot, _data, num, stride, func); + } + + bool isSorted(const void *data, size_t num, size_t stride, ComparisonFn func) { + if (num < 2) { + return true; + } + uint8_t *data_ = (uint8_t *)data; + for (size_t i=1; i 0) { + offset = idx + 1; + } else { + return idx; + } + } + return ~offset; + } + + int32_t binSearch(int32_t key, int32_t* array, size_t num, ComparisonFn func) { + return binSearchImpl(&key, &array[0], num, sizeof(int32_t), func); + } +} // namespace cppcore diff --git a/include/cppcore/Common/TBitField.h b/include/cppcore/Common/TBitField.h index 742d512..9e7fc4d 100644 --- a/include/cppcore/Common/TBitField.h +++ b/include/cppcore/Common/TBitField.h @@ -1,7 +1,7 @@ /*----------------------------------------------------------------------------------------------- The MIT License (MIT) -Copyright (c) 2014-2024 Kim Kulling +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 diff --git a/include/cppcore/Common/TOptional.h b/include/cppcore/Common/TOptional.h index c1a9e97..4d449a4 100644 --- a/include/cppcore/Common/TOptional.h +++ b/include/cppcore/Common/TOptional.h @@ -1,7 +1,7 @@ /*----------------------------------------------------------------------------------------------- The MIT License (MIT) -Copyright (c) 2014-2024 Kim Kulling +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 diff --git a/include/cppcore/Common/TStringBase.h b/include/cppcore/Common/TStringBase.h index 0305b8a..c6cce64 100644 --- a/include/cppcore/Common/TStringBase.h +++ b/include/cppcore/Common/TStringBase.h @@ -1,7 +1,7 @@ /*----------------------------------------------------------------------------------------------- The MIT License (MIT) -Copyright (c) 2014-2024 Kim Kulling +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 diff --git a/include/cppcore/Common/Variant.h b/include/cppcore/Common/Variant.h index bfc58bb..b220254 100644 --- a/include/cppcore/Common/Variant.h +++ b/include/cppcore/Common/Variant.h @@ -1,7 +1,7 @@ /*----------------------------------------------------------------------------------------------- The MIT License (MIT) -Copyright (c) 2014-2024 Kim Kulling +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 diff --git a/include/cppcore/Container/TArray.h b/include/cppcore/Container/TArray.h index b7bc463..443059e 100644 --- a/include/cppcore/Container/TArray.h +++ b/include/cppcore/Container/TArray.h @@ -1,7 +1,7 @@ /*----------------------------------------------------------------------------------------------- The MIT License (MIT) -Copyright (c) 2014-2024 Kim Kulling +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 diff --git a/include/cppcore/Container/THashMap.h b/include/cppcore/Container/THashMap.h index bb20a2f..33a29d1 100644 --- a/include/cppcore/Container/THashMap.h +++ b/include/cppcore/Container/THashMap.h @@ -1,7 +1,7 @@ /*----------------------------------------------------------------------------------------------- The MIT License (MIT) -Copyright (c) 2014-2024 Kim Kulling +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 diff --git a/include/cppcore/Container/TList.h b/include/cppcore/Container/TList.h index 2a16cde..cd1213b 100644 --- a/include/cppcore/Container/TList.h +++ b/include/cppcore/Container/TList.h @@ -1,7 +1,7 @@ /*----------------------------------------------------------------------------------------------- The MIT License (MIT) -Copyright (c) 2014-2024 Kim Kulling +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 diff --git a/include/cppcore/Container/TQueue.h b/include/cppcore/Container/TQueue.h index 6c40f12..2e5255d 100644 --- a/include/cppcore/Container/TQueue.h +++ b/include/cppcore/Container/TQueue.h @@ -1,7 +1,7 @@ /*----------------------------------------------------------------------------------------------- The MIT License (MIT) -Copyright (c) 2014-2024 Kim Kulling +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 diff --git a/include/cppcore/Container/TStaticArray.h b/include/cppcore/Container/TStaticArray.h index dc13f57..a24ab04 100644 --- a/include/cppcore/Container/TStaticArray.h +++ b/include/cppcore/Container/TStaticArray.h @@ -1,7 +1,7 @@ /*----------------------------------------------------------------------------------------------- The MIT License (MIT) -Copyright (c) 2014-2024 Kim Kulling +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 diff --git a/include/cppcore/Memory/MemUtils.h b/include/cppcore/Memory/MemUtils.h index e6e681f..2bc9103 100644 --- a/include/cppcore/Memory/MemUtils.h +++ b/include/cppcore/Memory/MemUtils.h @@ -1,7 +1,7 @@ /*----------------------------------------------------------------------------------------------- The MIT License (MIT) -Copyright (c) 2014-2024 Kim Kulling +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 diff --git a/include/cppcore/Memory/TDefaultAllocator.h b/include/cppcore/Memory/TDefaultAllocator.h index 583e3f4..bcc74f7 100644 --- a/include/cppcore/Memory/TDefaultAllocator.h +++ b/include/cppcore/Memory/TDefaultAllocator.h @@ -1,7 +1,7 @@ /*----------------------------------------------------------------------------------------------- The MIT License (MIT) -Copyright (c) 2014-2024 Kim Kulling +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 diff --git a/include/cppcore/Memory/TPoolAllocator.h b/include/cppcore/Memory/TPoolAllocator.h index d212776..60f7e38 100644 --- a/include/cppcore/Memory/TPoolAllocator.h +++ b/include/cppcore/Memory/TPoolAllocator.h @@ -1,7 +1,7 @@ /*----------------------------------------------------------------------------------------------- The MIT License (MIT) -Copyright (c) 2014-2024 Kim Kulling +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 diff --git a/include/cppcore/Memory/TStackAllocator.h b/include/cppcore/Memory/TStackAllocator.h index ece9b0c..fd28292 100644 --- a/include/cppcore/Memory/TStackAllocator.h +++ b/include/cppcore/Memory/TStackAllocator.h @@ -1,7 +1,7 @@ /*----------------------------------------------------------------------------------------------- The MIT License (MIT) -Copyright (c) 2014-2024 Kim Kulling +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 diff --git a/include/cppcore/Random/RandomGenerator.h b/include/cppcore/Random/RandomGenerator.h index 797af28..7247176 100644 --- a/include/cppcore/Random/RandomGenerator.h +++ b/include/cppcore/Random/RandomGenerator.h @@ -1,7 +1,7 @@ /*----------------------------------------------------------------------------------------------- The MIT License (MIT) -Copyright (c) 2014-2024 Kim Kulling +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 diff --git a/test/CPPCoreCommonTest.cpp b/test/CPPCoreCommonTest.cpp index 7065947..a435936 100644 --- a/test/CPPCoreCommonTest.cpp +++ b/test/CPPCoreCommonTest.cpp @@ -2,7 +2,7 @@ ------------------------------------------------------------------------------------------------- The MIT License (MIT) -Copyright (c) 2014-2024 Kim Kulling +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 diff --git a/test/common/HashTest.cpp b/test/common/HashTest.cpp index 80a4e9a..dd40c9b 100644 --- a/test/common/HashTest.cpp +++ b/test/common/HashTest.cpp @@ -2,7 +2,7 @@ ------------------------------------------------------------------------------------------------- The MIT License (MIT) -Copyright (c) 2014-2024 Kim Kulling +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 diff --git a/test/common/SortTest.cpp b/test/common/SortTest.cpp new file mode 100644 index 0000000..dc56bef --- /dev/null +++ b/test/common/SortTest.cpp @@ -0,0 +1,65 @@ +/* +------------------------------------------------------------------------------------------------- +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 "gtest/gtest.h" + +using namespace cppcore; + +class SortTest : public testing::Test {}; + +TEST_F(SortTest, swapTest) { + int32_t i1 = 1; + int32_t i2 = 2; + swap(i1, i2); + EXPECT_EQ(i1, 2); + EXPECT_EQ(i2, 1); +} + +TEST_F(SortTest, isSortedTest ) { + int32_t arr[] = {1,2,3,4,5}; + bool sorted = isSorted(arr, 5, sizeof(int32_t), compDescending); + EXPECT_TRUE(sorted); +} + +TEST_F(SortTest, isNotSortedTest) { + int32_t arr[] = { 1, 2, 3, 5, 4 }; + bool sorted = isSorted(arr, 5, sizeof(int32_t), compDescending); + EXPECT_FALSE(sorted); +} + +TEST_F(SortTest, quicksortTest) { + int32_t arr[] = { 1, 2, 3, 5, 4 }; + quicksort(arr, 5, sizeof(int32_t), compDescending); + bool sorted = isSorted(arr, 5, sizeof(int32_t), compDescending); + EXPECT_TRUE(sorted); +} + +TEST_F(SortTest, binSearchTest) { + int32_t arr[] = { 1, 2, 3, 5, 4 }; + quicksort(arr, 5, sizeof(int32_t), compDescending); + int32_t idx = binSearch(3, arr, 5, compDescending); + EXPECT_EQ(idx, 2); +} diff --git a/test/common/TBitFieldTest.cpp b/test/common/TBitFieldTest.cpp index 0a5c5f9..f86fccc 100644 --- a/test/common/TBitFieldTest.cpp +++ b/test/common/TBitFieldTest.cpp @@ -2,7 +2,7 @@ ------------------------------------------------------------------------------------------------- The MIT License (MIT) -Copyright (c) 2014-2024 Kim Kulling +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 diff --git a/test/common/TOptionalTest.cpp b/test/common/TOptionalTest.cpp index dce1787..980facb 100644 --- a/test/common/TOptionalTest.cpp +++ b/test/common/TOptionalTest.cpp @@ -1,7 +1,7 @@ /*----------------------------------------------------------------------------------------------- The MIT License (MIT) -Copyright (c) 2014-2024 Kim Kulling +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 diff --git a/test/common/VariantTest.cpp b/test/common/VariantTest.cpp index 76745dc..de17f87 100644 --- a/test/common/VariantTest.cpp +++ b/test/common/VariantTest.cpp @@ -1,7 +1,7 @@ /*----------------------------------------------------------------------------------------------- The MIT License (MIT) -Copyright (c) 2014-2024 Kim Kulling +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 diff --git a/test/container/TArrayTest.cpp b/test/container/TArrayTest.cpp index d4fc005..ead6072 100644 --- a/test/container/TArrayTest.cpp +++ b/test/container/TArrayTest.cpp @@ -2,7 +2,7 @@ ------------------------------------------------------------------------------------------------- The MIT License (MIT) -Copyright (c) 2014-2024 Kim Kulling +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 diff --git a/test/container/THashMapTest.cpp b/test/container/THashMapTest.cpp index 2a5c944..9aba9c7 100644 --- a/test/container/THashMapTest.cpp +++ b/test/container/THashMapTest.cpp @@ -2,7 +2,7 @@ ------------------------------------------------------------------------------------------------- The MIT License (MIT) -Copyright (c) 2014-2024 Kim Kulling +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 @@ -28,9 +28,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. using namespace ::cppcore; -class THashMapTest : public ::testing::Test { - // empty -}; +class THashMapTest : public ::testing::Test {}; TEST_F( THashMapTest, constructTest ) { bool ok( true ); diff --git a/test/container/TListTest.cpp b/test/container/TListTest.cpp index 2a1566d..901e476 100644 --- a/test/container/TListTest.cpp +++ b/test/container/TListTest.cpp @@ -2,7 +2,7 @@ ------------------------------------------------------------------------------------------------- The MIT License (MIT) -Copyright (c) 2014-2024 Kim Kulling +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 diff --git a/test/container/TQueueTest.cpp b/test/container/TQueueTest.cpp index 2dbd94d..7072f20 100644 --- a/test/container/TQueueTest.cpp +++ b/test/container/TQueueTest.cpp @@ -2,7 +2,7 @@ ------------------------------------------------------------------------------------------------- The MIT License (MIT) -Copyright (c) 2014-2024 Kim Kulling +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 diff --git a/test/container/TStaticArrayTest.cpp b/test/container/TStaticArrayTest.cpp index 03ac3f9..c3a580b 100644 --- a/test/container/TStaticArrayTest.cpp +++ b/test/container/TStaticArrayTest.cpp @@ -2,7 +2,7 @@ ------------------------------------------------------------------------------------------------- The MIT License (MIT) -Copyright (c) 2014-2024 Kim Kulling +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 diff --git a/test/io/FileSystemTest.cpp b/test/io/FileSystemTest.cpp index 8885e53..f25f3ad 100644 --- a/test/io/FileSystemTest.cpp +++ b/test/io/FileSystemTest.cpp @@ -2,7 +2,7 @@ ------------------------------------------------------------------------------------------------- The MIT License (MIT) -Copyright (c) 2014-2024 Kim Kulling +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 diff --git a/test/memory/TPoolAllocatorTest.cpp b/test/memory/TPoolAllocatorTest.cpp index eb6d5e3..09f0127 100644 --- a/test/memory/TPoolAllocatorTest.cpp +++ b/test/memory/TPoolAllocatorTest.cpp @@ -1,7 +1,7 @@ /*------------------------------------------------------------------------------------------------- The MIT License (MIT) -Copyright (c) 2014-2024 Kim Kulling +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 @@ -34,8 +34,7 @@ class TPoolAllocatorTest : public testing::Test { struct PoolItem { int id; - PoolItem() - : id(0) { + PoolItem() : id(0) { // empty } }; @@ -50,7 +49,7 @@ TEST_F(TPoolAllocatorTest, createTest) { EXPECT_TRUE( ok ); } -static const size_t NumItems = 500; +static constexpr size_t NumItems = 500; TEST_F(TPoolAllocatorTest, alloc_access_Test) { TPoolAllocator allocator; diff --git a/test/memory/TScratchAllocatorTest.cpp b/test/memory/TScratchAllocatorTest.cpp index e85de85..48d29e3 100644 --- a/test/memory/TScratchAllocatorTest.cpp +++ b/test/memory/TScratchAllocatorTest.cpp @@ -1,7 +1,7 @@ /*----------------------------------------------------------------------------------------------- The MIT License (MIT) -Copyright (c) 2014-2024 Kim Kulling +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 @@ -28,7 +28,7 @@ using namespace cppcore; class TScratchAllocatorTest : public testing::Test { public: - const size_t BufferSize = 1024u; + static constexpr size_t BufferSize = 1024u; }; TEST_F(TScratchAllocatorTest, CreateTest) { @@ -64,4 +64,3 @@ TEST_F(TScratchAllocatorTest, ClearTest) { EXPECT_EQ(myAllocator.capacity(), 0u); EXPECT_EQ(myAllocator.freeMem(), 0u); } - diff --git a/test/memory/TStackAllocatorTest.cpp b/test/memory/TStackAllocatorTest.cpp index dad0c99..e1f41f8 100644 --- a/test/memory/TStackAllocatorTest.cpp +++ b/test/memory/TStackAllocatorTest.cpp @@ -1,7 +1,7 @@ /*------------------------------------------------------------------------------------------------- The MIT License (MIT) -Copyright (c) 2014-2024 Kim Kulling +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 diff --git a/test/random/RandomGeneratorTest.cpp b/test/random/RandomGeneratorTest.cpp index a06656c..20e8ed4 100644 --- a/test/random/RandomGeneratorTest.cpp +++ b/test/random/RandomGeneratorTest.cpp @@ -1,7 +1,7 @@ /*------------------------------------------------------------------------------------------------- The MIT License (MIT) -Copyright (c) 2014-2024 Kim Kulling +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