Skip to content

clock: add more test cases to canonical test data #210

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
Mar 28, 2016
Merged

clock: add more test cases to canonical test data #210

merged 1 commit into from
Mar 28, 2016

Conversation

kytrinyx
Copy link
Member

In the Go track I've seen a lot of people who only account for a clock
overflowing once in either direction. As the README describes the
problem, any overflow should be corrected, even if it accounts for
several days.

The second problem that I've seen a lot is people who adjust in the
display method, which means that the clocks would fail the equality
check. We weren't verifying equality against overflow, however, so we
didn't catch this.

I also removed two redundant test cases.

"expected": true
},
{
"description": "clocks with negative hours and minutes that wrap",
Copy link
Member

Choose a reason for hiding this comment

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

this doesn't appear to be negative

and this appears to affect the test case's correctness since this results in 18:07 vs 5:53

Copy link
Member Author

Choose a reason for hiding this comment

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

Oops, both of those were supposed to be negative. It's harder to test these--I should have regenerated the Go tests using this; I'll go do that now.

@kytrinyx
Copy link
Member Author

I generated the Go test suite locally to test the changes this time.

@petertseng
Copy link
Member

👍 from me, though you've thought about this exercise more than I have. That means that while I am able to reason about whether the tests added by this PR make sense, I may miss tests that are not added by this PR that maybe should be. Luckily that's not so terrible since they can just be added in another PR.

I did have one thought: Is there a test for adding 0 to a clock, and should there be?

@kytrinyx
Copy link
Member Author

There is no such test, and I think that it's a good case to have.

In the Go track I've seen a lot of people who only account for a clock
overflowing once in either direction. As the README describes the
problem, any overflow should be corrected, even if it accounts for
several days.

The second problem that I've seen a lot is people who adjust in the
display method, which means that the clocks would fail the equality
check. We weren't verifying equality against overflow, however, so we
didn't catch this.

I also removed two redundant test cases.
@kytrinyx
Copy link
Member Author

I've added the missing test. I regenerated the Go test suite and verified that it generates a passing set of tests.

@petertseng
Copy link
Member

👍 , made a quick clock implementation and tested it against the json file, seems good

@kytrinyx
Copy link
Member Author

Ok, thanks for being a second pair of eyes on this!

@kytrinyx kytrinyx merged commit 727a593 into master Mar 28, 2016
@kytrinyx kytrinyx deleted the clock branch March 28, 2016 20:03
emcoding pushed a commit that referenced this pull request Nov 19, 2018
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.

2 participants