diff --git a/.gitignore b/.gitignore index 89cc49c..03ddf38 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ .vscode/c_cpp_properties.json .vscode/launch.json .vscode/ipch +test/build/* diff --git a/src/libs/CircularBuffer.h b/src/libs/CircularBuffer.h index e1a9d25..77a082b 100644 --- a/src/libs/CircularBuffer.h +++ b/src/libs/CircularBuffer.h @@ -1,4 +1,5 @@ #include +#include enum class ErrorCode { SUCCESS, @@ -29,6 +30,8 @@ public: } ErrorCode pushBack(const T& item) { + Serial.print(_count); + Serial.print(_capacity); if (_count == _capacity) { return ErrorCode::BUFFER_FULL; } diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 7bcb8c8..84ab700 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -9,10 +9,11 @@ include_directories( ${ARDUINO_MOCK_LIBS_DIR}/lib/gtest/gtest/src/gtest/googletest/include ${ARDUINO_MOCK_LIBS_DIR}/lib/gtest/gtest/src/gtest/googlemock/include ) +message(ARDUINO_MOCK_INCLUDE_DIRS="${ARDUINO_MOCK_INCLUDE_DIRS}") -file(GLOB LIB_SRCS "../*.ino") +file(GLOB LIBS_SRCS "libs/*.cpp") file(GLOB SRCS "*.cpp") -add_executable(test-all ${SRCS} ${LIB_SRCS}) +add_executable(test-all ${SRCS} ${LIBS_SRCS}) target_link_libraries(test-all ${ARDUINO_MOCK_LIBS_DIR}/lib/gtest/gtest/src/gtest-build/googlemock/gtest/libgtest.a diff --git a/test/arduino_mock/CMakeLists.txt b/test/arduino_mock/CMakeLists.txt index d70698b..c6a3b96 100644 --- a/test/arduino_mock/CMakeLists.txt +++ b/test/arduino_mock/CMakeLists.txt @@ -10,7 +10,7 @@ ExternalProject_Add(arduino_mock ) ExternalProject_Get_Property(arduino_mock source_dir) -set(ARDUINO_MOCK_INCLUDE_DIRS ${source_dir}/include PARENT_SCOPE) +set(ARDUINO_MOCK_INCLUDE_DIRS ${source_dir}/include/arduino-mock PARENT_SCOPE) ExternalProject_Get_Property(arduino_mock binary_dir) set(ARDUINO_MOCK_LIBS_DIR ${binary_dir} PARENT_SCOPE) diff --git a/test/build.sh b/test/build.sh old mode 100644 new mode 100755 diff --git a/test/libs/CircularBufferTest.h b/test/libs/CircularBuffer_unittest.cpp similarity index 99% rename from test/libs/CircularBufferTest.h rename to test/libs/CircularBuffer_unittest.cpp index a0b791b..29e6a3a 100644 --- a/test/libs/CircularBufferTest.h +++ b/test/libs/CircularBuffer_unittest.cpp @@ -73,4 +73,4 @@ TEST_F(CircularBufferTest, FullAndEmpty) { // Try popping from an empty buffer EXPECT_EQ(buffer->popFront(item), ErrorCode::BUFFER_EMPTY); -} \ No newline at end of file +}