diff options
| author | Amlal El Mahrouss <amlal@nekernel.org> | 2026-03-23 22:59:53 +0100 |
|---|---|---|
| committer | Amlal El Mahrouss <amlal@nekernel.org> | 2026-03-23 22:59:53 +0100 |
| commit | 4c65791784813d00cb976da9ad7b4215f0ad03db (patch) | |
| tree | 246fc1b16a981bd0b6c4c65a66ae74233d3ecf4a /test/standard_tests | |
| parent | 1131c5450865d5fc0f91a1b8fd267c90430a1cb6 (diff) | |
Signed-off-by: Amlal El Mahrouss <amlal@nekernel.org>
Diffstat (limited to 'test/standard_tests')
| -rw-r--r-- | test/standard_tests/Jamfile.v2 | 19 | ||||
| -rw-r--r-- | test/standard_tests/allocator_op.test.cpp | 25 | ||||
| -rw-r--r-- | test/standard_tests/option.test.cpp | 25 |
3 files changed, 69 insertions, 0 deletions
diff --git a/test/standard_tests/Jamfile.v2 b/test/standard_tests/Jamfile.v2 new file mode 100644 index 0000000..bf37293 --- /dev/null +++ b/test/standard_tests/Jamfile.v2 @@ -0,0 +1,19 @@ +# +# File: Jamfile.v2 +# Author: Amlal El Mahrouss, +# Copyright 2025, Amlal El Mahrouss, Licensed under the Boost Software License +# + +project tests +: default-build debug +; + +exe option.test.o + : option.test.cpp + : <cxxstd>20 ; + +exe allocator_op.test.o + : allocator_op.test.cpp + : <cxxstd>20 ; + + diff --git a/test/standard_tests/allocator_op.test.cpp b/test/standard_tests/allocator_op.test.cpp new file mode 100644 index 0000000..0982dcd --- /dev/null +++ b/test/standard_tests/allocator_op.test.cpp @@ -0,0 +1,25 @@ +// SPDX-License-Identifier: BSL-1.0 +// Copyright 2025-2026, Amlal El Mahrouss (amlal@nekernel.org) +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// Official repository: https://github.com/ocl-foss-org/core + +/// @author Amlal El Mahrouss + +#include <ocl/allocator_op.hpp> + +#define BOOST_TEST_MODULE allocator_op +#include <boost/test/included/unit_test.hpp> + +BOOST_AUTO_TEST_CASE(allocator_should_succeed) +{ + auto ptr = ocl::allocator<int>{}.construct_array<10>(); + int* arr = ptr.get(); + BOOST_TEST(arr != nullptr); + + for (auto i{0ul}; i < 10; ++i) + { + *(arr + i) = 10; + BOOST_TEST(*(arr + i) == 10); + } +} diff --git a/test/standard_tests/option.test.cpp b/test/standard_tests/option.test.cpp new file mode 100644 index 0000000..18e8cbb --- /dev/null +++ b/test/standard_tests/option.test.cpp @@ -0,0 +1,25 @@ +// SPDX-License-Identifier: BSL-1.0 +// Copyright 2025-2026, Amlal El Mahrouss (amlal@nekernel.org) +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// Official repository: https://github.com/ocl-foss-org/core + +/// @brief Checks if the test fails with the expected value. +/// @author Amlal El Mahrouss + +#include <ocl/option.hpp> + +#define BOOST_TEST_MODULE option +#include <boost/test/included/unit_test.hpp> + +BOOST_AUTO_TEST_CASE(option_should_fail) +{ + ocl::option opt(ocl::eval_false()); + BOOST_CHECK_THROW(opt.expect(""), std::exception); +} + +BOOST_AUTO_TEST_CASE(option_should_succeed) +{ + ocl::option opt(ocl::eval_true()); + BOOST_CHECK_NO_THROW(opt.expect("")); +} |
