diff options
| -rw-r--r-- | include/ocl/allocator_op.hpp | 6 | ||||
| -rw-r--r-- | include/ocl/basic_hash.hpp | 4 | ||||
| -rw-r--r-- | include/ocl/detail/config.hpp | 16 | ||||
| -rw-r--r-- | include/ocl/option.hpp | 2 | ||||
| -rw-r--r-- | include/ocl/print.hpp | 4 | ||||
| -rw-r--r-- | test/allocator_op.test.cpp | 8 | ||||
| -rw-r--r-- | test/option.test.cpp | 42 |
7 files changed, 45 insertions, 37 deletions
diff --git a/include/ocl/allocator_op.hpp b/include/ocl/allocator_op.hpp index 86bfa56..f40001f 100644 --- a/include/ocl/allocator_op.hpp +++ b/include/ocl/allocator_op.hpp @@ -17,7 +17,8 @@ namespace ocl template <typename type> struct global_new_op final { - using pointer_type = type*; + using pointer_type = type*; + using const_pointer_type = const type*; auto alloc() -> pointer_type { @@ -41,6 +42,7 @@ namespace ocl struct global_array_delete_op final { using pointer_type = type*; + using const_pointer_type = const type*; auto operator()(pointer_type t) -> void { @@ -48,7 +50,7 @@ namespace ocl } }; - /// \brief Allocator operations structure. Takes care of memory mgmt within a pool. + /// \brief Allocator operations structure. Takes care of memory mgmt within a pool. template <typename ret_type, typename allocator_new, typename allocator_delete> class allocator_op { diff --git a/include/ocl/basic_hash.hpp b/include/ocl/basic_hash.hpp index 3704bff..a6978fc 100644 --- a/include/ocl/basic_hash.hpp +++ b/include/ocl/basic_hash.hpp @@ -12,7 +12,7 @@ /// @brief OCL equivalence namespace. namespace ocl { - /// \brief Hash helper. + /// \brief Hash helper. template <class T> struct basic_hash { @@ -26,7 +26,7 @@ namespace ocl } }; - /// \brief For all boolean types, return false as they are not hashable + /// \brief For all boolean types, return false as they are not hashable template <> struct basic_hash<bool> { diff --git a/include/ocl/detail/config.hpp b/include/ocl/detail/config.hpp index 8ddb7e9..16a74ac 100644 --- a/include/ocl/detail/config.hpp +++ b/include/ocl/detail/config.hpp @@ -55,13 +55,13 @@ namespace ocl { - namespace detail - { - inline void throw_runtime_error(const boost::string_view& loc = BOOST_CURRENT_LOCATION.to_string()) - { - throw std::runtime_error(loc.to_string()); - } - } -} + namespace detail + { + inline void throw_runtime_error(const boost::string_view& loc = BOOST_CURRENT_LOCATION.to_string()) + { + throw std::runtime_error(loc.to_string()); + } + } // namespace detail +} // namespace ocl #endif diff --git a/include/ocl/option.hpp b/include/ocl/option.hpp index 93e01c7..7f66579 100644 --- a/include/ocl/option.hpp +++ b/include/ocl/option.hpp @@ -53,7 +53,7 @@ namespace ocl if (ret_ == return_type::err) { io::println(input ? input : "option::error"); - detail::throw_option_invalid_type_error(); + detail::throw_option_invalid_type_error(); } return *this; diff --git a/include/ocl/print.hpp b/include/ocl/print.hpp index 70b79dd..98c4d6b 100644 --- a/include/ocl/print.hpp +++ b/include/ocl/print.hpp @@ -43,13 +43,13 @@ namespace ocl::io { inline bool is_stdio_sync = true; - using io_error = std::runtime_error; + using io_error = std::runtime_error; inline void throw_option_invalid_type_error(const boost::string_view& loc = BOOST_CURRENT_LOCATION.to_string()) { throw io_error(loc.to_string()); } - } + } // namespace detail inline void enable_stdio_sync(const bool& enable) noexcept { diff --git a/test/allocator_op.test.cpp b/test/allocator_op.test.cpp index 890c9bc..925df8c 100644 --- a/test/allocator_op.test.cpp +++ b/test/allocator_op.test.cpp @@ -8,9 +8,9 @@ #define BOOST_TEST_MODULE allocator_op #include <boost/test/included/unit_test.hpp> -BOOST_AUTO_TEST_CASE( allocator_should_succeed ) +BOOST_AUTO_TEST_CASE(allocator_should_succeed) { - auto ptr = ocl::allocator<int>{}.construct_array<10>(); - int* arr = ptr.get(); - BOOST_TEST( arr != nullptr ); + auto ptr = ocl::allocator<int>{}.construct_array<10>(); + int* arr = ptr.get(); + BOOST_TEST(arr != nullptr); } diff --git a/test/option.test.cpp b/test/option.test.cpp index fdc8d37..3cc336f 100644 --- a/test/option.test.cpp +++ b/test/option.test.cpp @@ -8,26 +8,32 @@ #define BOOST_TEST_MODULE option #include <boost/test/included/unit_test.hpp> -BOOST_AUTO_TEST_CASE( option_should_fail ) +BOOST_AUTO_TEST_CASE(option_should_fail) { - bool ret = false; - try { - ocl::option opt(ocl::eval_false()); - opt.expect(""); - } catch (...) { - ret = true; - } - BOOST_TEST( ret == true ); + bool ret = false; + try + { + ocl::option opt(ocl::eval_false()); + opt.expect(""); + } + catch (...) + { + ret = true; + } + BOOST_TEST(ret == true); } -BOOST_AUTO_TEST_CASE( option_should_succeed ) +BOOST_AUTO_TEST_CASE(option_should_succeed) { - bool ret = true; - try { - ocl::option opt(ocl::eval_true()); - opt.expect(""); - } catch (...) { - ret = false; - } - BOOST_TEST( ret == true ); + bool ret = true; + try + { + ocl::option opt(ocl::eval_true()); + opt.expect(""); + } + catch (...) + { + ret = false; + } + BOOST_TEST(ret == true); } |
