diff --git a/.gitignore b/.gitignore index 32bf260..76e18ec 100644 --- a/.gitignore +++ b/.gitignore @@ -3,4 +3,5 @@ cmake-build-debug cmake-build-release build Testing/Temporary +_codeql_build_dir diff --git a/_codeql_detected_source_root b/_codeql_detected_source_root new file mode 120000 index 0000000..945c9b4 --- /dev/null +++ b/_codeql_detected_source_root @@ -0,0 +1 @@ +. \ No newline at end of file diff --git a/test_main.cpp b/test_main.cpp index 0954af4..2c784eb 100644 --- a/test_main.cpp +++ b/test_main.cpp @@ -119,7 +119,26 @@ TEST(RingBufferTest, IteratorsFromDifferentBuffersAreNotEqual) { ring_buffer b1; ring_buffer b2; + // Iterators from different buffers should not be equal EXPECT_NE(b1.cbegin(), b2.cbegin()); + + // Add elements to both buffers + b1.push_back(1); + b1.push_back(2); + b2.push_back(1); + b2.push_back(2); + + // Iterators at the same logical position from different buffers should still be unequal + EXPECT_NE(b1.cbegin(), b2.cbegin()); + EXPECT_NE(b1.cend(), b2.cend()); + + // Iterators from the same buffer at the same position should be equal + EXPECT_EQ(b1.cbegin(), b1.cbegin()); + EXPECT_EQ(b1.cend(), b1.cend()); + + // begin() and end() from the same buffer should be different when not empty + EXPECT_NE(b1.cbegin(), b1.cend()); + EXPECT_NE(b2.cbegin(), b2.cend()); } TEST(RingBufferTest, NoOverwriteWhenFull) {