Skip to content

circular-buffer: Test overwrite on non-full buffer #180

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 22, 2015
Merged

circular-buffer: Test overwrite on non-full buffer #180

merged 1 commit into from
Oct 22, 2015

Conversation

petertseng
Copy link
Member

This test is useful to make sure implementations don't drop items from
non-full buffers when using Overwrite.

@petertseng
Copy link
Member Author

Examining other language tracks:
http://x.exercism.io/problems/circular-buffer

Tracks that include this test:

Tracks that do not include this test:

  • erlang (but it does test their equivalent of ovewrite on a completely empty buffer, so maybe that is close enough?)
  • javascript
  • lfe (same comment as erlang)
  • lua

So it is possible that the Ruby track was the first to actually explicitly test this behavior of Overwrite (what should it do when the buffer isn't full), and I guess now's a good a time as any to ask whether it should be spread to the other tracks with circular-buffer.

E: Yeah I see, it wasn't in the original version of Ruby circular-buffer but was added later in exercism/ruby@5560b7a for exercism/ruby#123 - so a test for that behavior got added to Ruby track but not ported over to other tracks as well, interesting to see that history.

@petertseng
Copy link
Member Author

Assumption: I should bump testVersion for this (because it might cause previously-passing solutions to fail). I will do so and amend the commit.

E: done so.
E: forgot I need to increment TestVersion in example.go as well, so broke the build. amended again, should be good this time.

This test is useful to make sure implementations don't drop items from
non-full buffers when using Overwrite.
@kytrinyx
Copy link
Member

Yeah, I think adding the test is a good idea. @soniakeys do you see any gotchas with this?

@soniakeys
Copy link
Contributor

Very nice. Thank you, Peter!

soniakeys added a commit that referenced this pull request Oct 22, 2015
circular-buffer: Test overwrite on non-full buffer
@soniakeys soniakeys merged commit c3bd7c6 into exercism:master Oct 22, 2015
@petertseng petertseng deleted the circular-buffer-test branch October 23, 2015 03:10
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.

3 participants