diff options
| author | Amlal El Mahrouss <amlal@nekernel.org> | 2025-11-24 02:13:48 +0100 |
|---|---|---|
| committer | Amlal El Mahrouss <amlal@nekernel.org> | 2025-11-24 02:13:48 +0100 |
| commit | 65a8349aa5526d071b18cd4d42586c46faaa3823 (patch) | |
| tree | f6e2063319ceaaa02f523fb5c289e4f37411a2df /tests/chunk_string/chunk_test.cc | |
| parent | df4ec096491ded6d58b9ee094d6942e3188c2d4a (diff) | |
feat! breaking changes for OCL v1.0.48.
Signed-off-by: Amlal El Mahrouss <amlal@nekernel.org>
Diffstat (limited to 'tests/chunk_string/chunk_test.cc')
| -rw-r--r-- | tests/chunk_string/chunk_test.cc | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/chunk_string/chunk_test.cc b/tests/chunk_string/chunk_test.cc new file mode 100644 index 0000000..6b2d290 --- /dev/null +++ b/tests/chunk_string/chunk_test.cc @@ -0,0 +1,31 @@ +/* + * File: tests/chunk_test.cc + * Purpose: Chunk unit tests in C++ + * Author: Amlal El Mahrouss (amlal@nekernel.org) + * Copyright 2025, Amlal El Mahrouss, licensed under the Boost Software License. + */ + +#include <io/print.hpp> +#include <tests/gtest.hpp> +#include <core/chunk_string.hpp> + +TEST(ChunkTest, BasicChunkUsage) +{ + const char* test_string = "HELLO, WORLD!\r\n"; + const auto iterations = 1024000; + const auto limit = 30; + + auto start = std::chrono::high_resolution_clock::now(); + + ocl::basic_chunk_string<char, iterations> optimized; + + for (unsigned i = 0; i < iterations; ++i) + { + optimized += test_string; + } + + auto end = std::chrono::high_resolution_clock::now(); + auto optimized_time = std::chrono::duration_cast<std::chrono::milliseconds>(end - start); + + EXPECT_TRUE(optimized_time.count() < 100U); +} |
