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

Create min/max functions that take bounds into account #141

Merged
merged 17 commits into from
Sep 23, 2020

Conversation

Arvind-Maan
Copy link
Contributor

@Arvind-Maan Arvind-Maan commented Sep 14, 2020

fixes #137

@Arvind-Maan Arvind-Maan reopened this Sep 14, 2020
@Arvind-Maan Arvind-Maan changed the title Am/bounded first/last Create min/max functions that take bounds into account Sep 14, 2020
src/interval.jl Outdated Show resolved Hide resolved
@codecov
Copy link

codecov bot commented Sep 14, 2020

Codecov Report

Merging #141 into master will increase coverage by 1.36%.
The diff coverage is 93.33%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #141      +/-   ##
==========================================
+ Coverage   74.40%   75.76%   +1.36%     
==========================================
  Files          11       11              
  Lines         461      491      +30     
==========================================
+ Hits          343      372      +29     
- Misses        118      119       +1     
Impacted Files Coverage Δ
src/interval.jl 94.93% <93.10%> (+0.36%) ⬆️
src/isfinite.jl 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a9d99c9...3b31ff4. Read the comment docs.

src/interval.jl Outdated Show resolved Hide resolved
src/interval.jl Outdated Show resolved Hide resolved
src/interval.jl Outdated Show resolved Hide resolved
src/interval.jl Outdated Show resolved Hide resolved
src/interval.jl Outdated Show resolved Hide resolved
src/interval.jl Outdated Show resolved Hide resolved
src/interval.jl Outdated Show resolved Hide resolved
src/interval.jl Outdated Show resolved Hide resolved
src/interval.jl Outdated Show resolved Hide resolved
src/interval.jl Outdated Show resolved Hide resolved
@omus
Copy link
Collaborator

omus commented Sep 15, 2020

Another thing I'm thinking about is the name "precision". Currently Julia already has a precision function which returns an integer. I think the term "increment" may be better suited

src/interval.jl Show resolved Hide resolved
test/interval.jl Outdated Show resolved Hide resolved
test/interval.jl Outdated Show resolved Hide resolved
src/interval.jl Outdated Show resolved Hide resolved
test/interval.jl Outdated Show resolved Hide resolved
src/interval.jl Outdated Show resolved Hide resolved
test/anchoredinterval.jl Outdated Show resolved Hide resolved
test/interval.jl Outdated Show resolved Hide resolved
test/interval.jl Outdated Show resolved Hide resolved
test/interval.jl Outdated Show resolved Hide resolved
@nickrobinson251
Copy link
Contributor

As a follow-up to this PR, it'd be nice to resolve #90 😊

src/interval.jl Outdated Show resolved Hide resolved
src/interval.jl Outdated Show resolved Hide resolved
src/interval.jl Show resolved Hide resolved
src/interval.jl Outdated Show resolved Hide resolved
test/anchoredinterval.jl Outdated Show resolved Hide resolved
test/anchoredinterval.jl Outdated Show resolved Hide resolved
test/anchoredinterval.jl Outdated Show resolved Hide resolved
test/anchoredinterval.jl Outdated Show resolved Hide resolved
test/interval.jl Show resolved Hide resolved
src/docstrings.jl Outdated Show resolved Hide resolved
src/docstrings.jl Outdated Show resolved Hide resolved
src/docstrings.jl Outdated Show resolved Hide resolved
src/docstrings.jl Outdated Show resolved Hide resolved
src/docstrings.jl Outdated Show resolved Hide resolved
src/docstrings.jl Outdated Show resolved Hide resolved
src/interval.jl Outdated Show resolved Hide resolved
@omus
Copy link
Collaborator

omus commented Sep 21, 2020

Thanks for sticking with this. Things are shaping up nicely now :)

Arvind Maan and others added 2 commits September 22, 2020 15:49
Co-Authored-By: Curtis Vogt <1675958+omus@users.noreply.github.com>
Co-Authored-By: Curtis Vogt <1675958+omus@users.noreply.github.com>
test/anchoredinterval.jl Outdated Show resolved Hide resolved

# If we get to this point, the min/max functions throw a DomainError
# Since we want our tests to be predictable, we will not throw an error in this helper.
end
Copy link
Collaborator

Choose a reason for hiding this comment

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

As theses helpers pretty much just re-implement minimum/maximum there aren't that helpful with testing. I think we can proceed with this but something to keep in mind for future work.

Copy link
Contributor Author

@Arvind-Maan Arvind-Maan Sep 23, 2020

Choose a reason for hiding this comment

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

I agree, in hindsight it would've been best to separate the tests per edge case and avoid having to do this. I constricted myself by trying to stay consistent with the first/last testing scheme and the test_values that were already in place.

Comment on lines 110 to 112
minimum(interval::AbstractInterval{T}; [increment]) -> T

The minimum value in the interval contained within the interval.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
minimum(interval::AbstractInterval{T}; [increment]) -> T
The minimum value in the interval contained within the interval.
minimum(interval::AbstractInterval{T}; [increment]) -> T
The minimum value contained within the `interval`.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Looks like this change was missed?

Comment on lines 123 to 125
maximum(interval::AbstractInterval{T}; increment::Any) -> T

The maximum value in the interval contained within the interval.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
maximum(interval::AbstractInterval{T}; increment::Any) -> T
The maximum value in the interval contained within the interval.
maximum(interval::AbstractInterval{T}; [increment]) -> T
The maximum value contained within the `interval`.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Looks like this change was missed?

src/docstrings.jl Show resolved Hide resolved
src/docstrings.jl Show resolved Hide resolved
Copy link
Collaborator

@omus omus left a comment

Choose a reason for hiding this comment

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

With these last changes we should be good.

@Arvind-Maan Arvind-Maan merged commit 6e3e3a2 into master Sep 23, 2020
@Arvind-Maan Arvind-Maan deleted the am/bounded-first/last branch September 23, 2020 19:05
omus added a commit that referenced this pull request Sep 23, 2020
* Add min/max functions with precision
* Add tests for new min/max functions
* Add default val for closed/unbounded intervals in min/max
* Rename min/max functions to minimum/maximum
* Rename percision kwarg in min/max to increment
* Add integer specific min/max function
* Add float specific min/max functions
* Respect the increment variable in AbstractFloat min/max
* Apply suggestions and add more tests
* Add unbounded accessor tests
* Add anchoredinterval support in min/max
* Adjust accessor test structure
* Handle various edge cases in min/max
* Add docstrings for min/max
* Update isfinite.jl to support TimeTypes
* Apply suggested changes
* Update docs to include bound-open

Co-authored-by: Curtis Vogt <curtis.vogt@gmail.com>
@omus
Copy link
Collaborator

omus commented Sep 23, 2020

PR was meant to be squashed. Squashed commit is c37cbb7

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.

Create min/max functions that take bounds into account
5 participants