-
Notifications
You must be signed in to change notification settings - Fork 0
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 RoundFullyContainedSampleSpans
#38
Open
ericphanson
wants to merge
10
commits into
eph/improve-docs
Choose a base branch
from
eph/round-fully-contained
base: eph/improve-docs
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
b60ca89
wip
ericphanson f39f4b5
Merge branch 'eph/improve-docs' into eph/round-fully-contained
ericphanson ad9e9b5
wip
ericphanson 21dceb7
Merge branch 'eph/improve-docs' into eph/round-fully-contained
ericphanson c02dc54
cleanup
ericphanson 5610074
fix and add tests
ericphanson 2eeb8a2
Apply suggestions from code review
ericphanson a46528f
fix link
ericphanson 23bd60e
add comments and use intervals abstraction
ericphanson 37071cc
Update src/interop.jl
ericphanson File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,6 +37,40 @@ end | |
end | ||
end | ||
|
||
@testset "RoundFullyContainedSampleSpans" begin | ||
input = TimeSpan(0, Second(30)) | ||
aligned = AlignedSpan(1 / 30, input, RoundFullyContainedSampleSpans) | ||
@test aligned == AlignedSpan(1 / 30, 1, 1) | ||
|
||
input = TimeSpan(0, Second(30) + Nanosecond(1)) | ||
aligned = AlignedSpan(1 / 30, input, RoundFullyContainedSampleSpans) | ||
@test aligned == AlignedSpan(1 / 30, 1, 1) | ||
|
||
input = TimeSpan(0, Second(59)) | ||
aligned = AlignedSpan(1 / 30, input, RoundFullyContainedSampleSpans) | ||
@test aligned == AlignedSpan(1 / 30, 1, 1) | ||
|
||
input = TimeSpan(0, Second(60)) | ||
aligned = AlignedSpan(1 / 30, input, RoundFullyContainedSampleSpans) | ||
@test aligned == AlignedSpan(1 / 30, 1, 2) | ||
|
||
input = TimeSpan(Nanosecond(1), Second(60) + Nanosecond(1)) | ||
aligned = AlignedSpan(1 / 30, input, RoundFullyContainedSampleSpans) | ||
@test aligned == AlignedSpan(1 / 30, 2, 2) | ||
|
||
input = TimeSpan(0, Second(60) + Nanosecond(1)) | ||
aligned = AlignedSpan(1 / 30, input, RoundFullyContainedSampleSpans) | ||
@test aligned == AlignedSpan(1 / 30, 1, 2) | ||
|
||
input = TimeSpan(0, Second(60)) | ||
aligned = AlignedSpan(1 / 30, input, RoundFullyContainedSampleSpans) | ||
@test aligned == AlignedSpan(1 / 30, 1, 2) | ||
|
||
# No spans contained | ||
input = TimeSpan(Nanosecond(1), Second(30) + Nanosecond(1)) | ||
@test_throws ArgumentError AlignedSpan(1 / 30, input, RoundFullyContainedSampleSpans) | ||
Comment on lines
+69
to
+71
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. do we really want this to be an error? or should it be like an empty span somehow? do we throw on any other failures to construct an appropriate span? |
||
end | ||
|
||
# https://github.com/beacon-biosignals/TimeSpans.jl/blob/e3c999021336e51a08d118e6defb792e38ac1cc7/test/runtests.jl#L93-L96 | ||
@testset "time_from_index" begin | ||
@test AlignedSpans.time_from_index(200, 0) == -Millisecond(5) | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just to check we are hitting this