Skip to content
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

Add some tests for our ring_buffer implementation. #964

Merged
merged 1 commit into from
Jul 4, 2018

Conversation

iphydf
Copy link
Member

@iphydf iphydf commented Jul 3, 2018

These can serve as documentation until we write actual api docs, probably
using apidsl.


This change is Reviewable

@iphydf iphydf added this to the v0.2.x milestone Jul 3, 2018
@iphydf iphydf force-pushed the ring-buffer-test branch 2 times, most recently from c38a0aa to 9f4de02 Compare July 3, 2018 20:19
Copy link

@zoff99 zoff99 left a comment

Choose a reason for hiding this comment

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

Reviewed 4 of 4 files at r1.
Reviewable status: 0 of 2 LGTMs obtained (waiting on @sudden6 and @zoff99)

Copy link

@zoff99 zoff99 left a comment

Choose a reason for hiding this comment

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

Reviewable status: 0 of 2 LGTMs obtained (waiting on @sudden6 and @zoff99)

@zoff99
Copy link

zoff99 commented Jul 4, 2018

can't find the LGTM on reviewable? hmm. some help?

Copy link

@zoff99 zoff99 left a comment

Choose a reason for hiding this comment

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

:lgtm:

Reviewable status: 0 of 2 LGTMs obtained, and 1 stale (waiting on @sudden6 and @zoff99)

Copy link

@sudden6 sudden6 left a comment

Choose a reason for hiding this comment

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

Reviewed 3 of 4 files at r1.
Reviewable status: 1 of 2 LGTMs obtained (waiting on @sudden6)


toxav/ring_buffer_test.cc, line 113 at r1 (raw file):

TEST(RingBuffer, ZeroSizeBufferCanBeWrittenToOnce) {
  TypedRingBuffer<int *> rb(0);

shouldn't a 0 size buffer return an error anyway?


toxav/ring_buffer_test.cc, line 178 at r1 (raw file):

  rb.read(&retrieved);
  EXPECT_EQ(rb.size(), 0);
}

Another test case would be interesting

  • create a buffer with size 4
  • insert 5
  • check that size == 4

Could maybe be part of WritingToBufferWhenFullOverwritesBeginning

These can serve as documentation until we write actual api docs, probably
using apidsl.
Copy link
Member Author

@iphydf iphydf left a comment

Choose a reason for hiding this comment

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

Reviewable status: 0 of 2 LGTMs obtained, and 1 stale (waiting on @sudden6 and @zoff99)


toxav/ring_buffer_test.cc, line 113 at r1 (raw file):

Previously, sudden6 wrote…

shouldn't a 0 size buffer return an error anyway?

It should, but doesn't. These tests check the current behaviour so that refactorings don't break the current behaviour. If we change the behaviour, we'll need to change the tests. I'm not changing the behaviour in this PR.


toxav/ring_buffer_test.cc, line 178 at r1 (raw file):

Previously, sudden6 wrote…

Another test case would be interesting

  • create a buffer with size 4
  • insert 5
  • check that size == 4

Could maybe be part of WritingToBufferWhenFullOverwritesBeginning

Done.

Copy link

@sudden6 sudden6 left a comment

Choose a reason for hiding this comment

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

:lgtm_strong:

Reviewed 1 of 1 files at r2.
Reviewable status: 1 of 2 LGTMs obtained, and 1 stale (waiting on @zoff99)


toxav/ring_buffer_test.cc, line 113 at r1 (raw file):

Previously, iphydf wrote…

It should, but doesn't. These tests check the current behaviour so that refactorings don't break the current behaviour. If we change the behaviour, we'll need to change the tests. I'm not changing the behaviour in this PR.

ok then

@iphydf
Copy link
Member Author

iphydf commented Jul 4, 2018

@zoff99 PTAL, I've added a test.

Copy link

@zoff99 zoff99 left a comment

Choose a reason for hiding this comment

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

Reviewed 1 of 1 files at r2.
Reviewable status: 1 of 2 LGTMs obtained, and 1 stale (waiting on @zoff99)

@zoff99
Copy link

zoff99 commented Jul 4, 2018

where is the LGTM button in reviewable? its gone. i dont understand. what has changed there?

Copy link

@zoff99 zoff99 left a comment

Choose a reason for hiding this comment

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

:lgtm:

Reviewable status: 1 of 2 LGTMs obtained, and 1 stale (waiting on @zoff99)

@iphydf iphydf merged commit 3ef1f83 into TokTok:master Jul 4, 2018
@iphydf iphydf deleted the ring-buffer-test branch July 4, 2018 11:55
@iphydf iphydf modified the milestones: v0.2.x, v0.2.4 Jul 16, 2018
This pull request was closed.
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