Skip to content

Conversation

@fpdotmonkey
Copy link

@fpdotmonkey fpdotmonkey commented Sep 4, 2020

This adds the tests test_raises_error_indexing_empty_buffer and test_negative_indices_give_recent_data_with_unfull_buffer to ensure the class doesn't access memory unsafely.

Closes #13 Closes #14

@codecov-commenter
Copy link

codecov-commenter commented Sep 4, 2020

Codecov Report

Merging #15 into master will increase coverage by 0.07%.
The diff coverage is 100.00%.

Impacted file tree graph

@@ Coverage Diff @@ ## master #15 +/- ## ========================================== + Coverage 98.49% 98.57% +0.07%  ========================================== Files 3 3 Lines 266 280 +14 ========================================== + Hits 262 276 +14  Misses 4 4 
Impacted Files Coverage Δ
numpy_ringbuffer/__init__.py 98.33% <100.00%> (+0.05%) ⬆️
tests.py 98.74% <100.00%> (+0.08%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5b4898e...6419640. Read the comment docs.

Comment on lines +174 to +175
item_arr = ((item_arr + self._left_index)
% self._right_index)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks wrong to me for cases when left_index != 0

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

test_append causes the buffer to wrap, which makes self._left_index be greater than 0, and it passes

@fpdotmonkey fpdotmonkey changed the title Fixes issues of unsafe memory access. Closes #13 Closes #14 Fixes issues of unsafe memory access Oct 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants