diff --git a/.github/workflows/circularbuffer_build_pipeline.yml b/.github/workflows/circularbuffer_build_pipeline.yml index 6083e3e..fb19c4c 100644 --- a/.github/workflows/circularbuffer_build_pipeline.yml +++ b/.github/workflows/circularbuffer_build_pipeline.yml @@ -1,6 +1,6 @@ name: Build and Test -on: [push] +on: [push, pull_request] env: # Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) diff --git a/circular_buffer.h b/circular_buffer.h index a60926f..0c3beec 100644 --- a/circular_buffer.h +++ b/circular_buffer.h @@ -13,7 +13,6 @@ template class CircularBuffer { private: - typedef T value_type; typedef T* pointer; typedef const T* const_pointer; typedef T& reference; @@ -24,6 +23,8 @@ class CircularBuffer { public: + typedef T value_type; + explicit CircularBuffer(size_t size) :_buff{std::unique_ptr(new value_type[size])}, _max_size{size}{} diff --git a/conanfile.py b/conanfile.py index 976c9e0..ac54b31 100644 --- a/conanfile.py +++ b/conanfile.py @@ -3,7 +3,7 @@ class CircularBufferConan(ConanFile): name = "circular_buffer" - version = "0.0.1" + version = "0.1.0" license = "MIT License" author = "vinit james vinit.james24@gmail.com" url = "https://github.com/vinitjames/circularbuffer" diff --git a/tests/CMakeLists.txt.in b/tests/CMakeLists.txt.in index 0385d1e..74f4aed 100644 --- a/tests/CMakeLists.txt.in +++ b/tests/CMakeLists.txt.in @@ -5,7 +5,7 @@ project(googletest-download NONE) include(ExternalProject) ExternalProject_Add(googletest GIT_REPOSITORY https://github.com/google/googletest.git - GIT_TAG master + GIT_TAG release-1.8.0 SOURCE_DIR "${CMAKE_CURRENT_BINARY_DIR}/googletest-src" BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/googletest-build" CONFIGURE_COMMAND "" diff --git a/tests/iterator_test.cpp b/tests/iterator_test.cpp index 356e540..4fa0d3a 100644 --- a/tests/iterator_test.cpp +++ b/tests/iterator_test.cpp @@ -5,7 +5,7 @@ #include "gtest/gtest.h" #define TEST_BUFFER_SIZE 100 -#define REDUCE_SIZE 100 +#define REDUCE_SIZE 50 class CircularBufferTest : public ::testing::Test{ @@ -70,10 +70,9 @@ TEST_F(CircularBufferTest, RangeBasedLoopTest){ //check iterators after modifications for(int i = 0; i buffer_copy; + buffer_copy.reserve(test_str_buff.size()); + std::copy(test_str_buff.begin(), test_str_buff.end(), std::back_inserter(buffer_copy)); + int i = 0; + for(const auto& elem: test_str_buff) + EXPECT_EQ(elem, buffer_copy[i++]); + buffer_copy.clear(); + //remove elements from buffer + for(int i=0; i