Skip to content

Add tests and fix for mdns NameSliceIter next_back - #104

Open
mlandauer wants to merge 1 commit into
sysgrok:masterfrom
mlandauer:fix_mdns_nameslice_iter_labels
Open

Add tests and fix for mdns NameSliceIter next_back#104
mlandauer wants to merge 1 commit into
sysgrok:masterfrom
mlandauer:fix_mdns_nameslice_iter_labels

Conversation

@mlandauer

Copy link
Copy Markdown

The backwards labels iterator for NameSlice would always return None. This adds some tests for the forward and backwards iterator that would fail with the current implementation.

To fix the issue I added a second index for tracking the backwards iterator seperate from the forward iterator.

The docs for DoubleEndedIterator says
"It is important to note that both back and forth work on the same range, and do not cross: iteration is over when they meet in the middle."

Then a small bit of refactoring to extract common code from the back and next_back.

The backwards labels iterator for NameSlice would always return None.
This adds some tests for the forward and backwards iterator that would
fail with the current implementation.

To fix the issue I added a second index for tracking the backwards
iterator seperate from the forward iterator.

The docs for DoubleEndedIterator says
"It is important to note that both back and forth work on the same
range, and do not cross: iteration is over when they meet in the
middle."

Then a small bit of refactoring to extract common code from the back and
next_back.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant