File tree Expand file tree Collapse file tree 3 files changed +17
-36
lines changed
Expand file tree Collapse file tree 3 files changed +17
-36
lines changed Original file line number Diff line number Diff line change 99 set (CMAKE_CXX_STANDARD 17)
1010endif ()
1111
12+ # Add Google Test
13+ # Include FetchContent to download and manage external dependencies
14+ include (FetchContent)
15+ FetchContent_Declare(
16+ googletest
17+ URL https://github.com/google/googletest/archive/refs/tags/release-1.11.0.zip
18+ )
19+ FetchContent_MakeAvailable(googletest)
1220
13- add_executable (RingBufferTest main.cpp)
21+ enable_testing ()
22+ add_executable (RingBufferTest test_main.cpp)
23+ target_link_libraries (RingBufferTest gtest gtest_main)
24+
25+
26+ include (GoogleTest)
27+ gtest_discover_tests(RingBufferTest)
Original file line number Diff line number Diff line change @@ -38,6 +38,7 @@ namespace buffers {
3838 using iterator_category = std::forward_iterator_tag;
3939
4040 ring_buffer_iterator () noexcept = default ;
41+
4142 ring_buffer_iterator (buffer_t source, size_type index, size_type count) noexcept
4243 : source_{source},
4344 index_{index},
@@ -181,6 +182,7 @@ using std::bool_constant;
181182 [[nodiscard]] const_iterator cend () const noexcept { return const_iterator{this , head_, size_};}
182183 [[nodiscard]] bool empty () const noexcept { return size_ == 0 ; }
183184 [[nodiscard]] bool full () const noexcept { return size_ == N; }
185+ [[nodiscard]] size_type size () const noexcept { return size_; }
184186 [[nodiscard]] size_type capacity () const noexcept { return N; }
185187 void clear () noexcept {
186188 destroy_all (bool_constant<is_trivially_destructible_v<value_type>>{});
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments