diff options
| author | Amlal El Mahrouss <amlal@nekernel.org> | 2025-11-23 20:16:02 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-11-23 20:16:02 -0500 |
| commit | 85f89ee4bb137100cbeffcbc10168eb8ea52e6cc (patch) | |
| tree | f6e2063319ceaaa02f523fb5c289e4f37411a2df /tests/chunk_string/chunk_test.cc | |
| parent | 9a70f32ddaec0eef99efbf7ff5597c2adf08f45a (diff) | |
| parent | 65a8349aa5526d071b18cd4d42586c46faaa3823 (diff) | |
Merge pull request #18 from amlel-el-mahrouss/developv1.0.48
OCL v1.0.48
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); +} |
