-
Notifications
You must be signed in to change notification settings - Fork 77
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
Fix off-by-one issue in isOverlapping
#2066
Merged
Merged
Changes from 4 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
d2e3a51
Fix an issue in computation of overlapping locations
sungshik cc3d30d
Revert "Fix an issue in computation of overlapping locations"
sungshik d196a58
Fix an issue in computation of overlapping locations
sungshik 6ab67d6
Add tests for `isOverlapping`
sungshik a0a22a7
Move tests for `isOverlapping` to existing file
sungshik 904f0be
Merge branch 'main' into fix-issue-in-isoverlapping
sungshik 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
20 changes: 20 additions & 0 deletions
20
src/org/rascalmpl/library/lang/rascal/tests/library/Location.rsc
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 |
---|---|---|
@@ -0,0 +1,20 @@ | ||
@license{ | ||
Copyright (c) 2013-2024 CWI | ||
All rights reserved. This program and the accompanying materials | ||
are made available under the terms of the Eclipse Public License v1.0 | ||
which accompanies this distribution, and is available at | ||
http://www.eclipse.org/legal/epl-v10.html | ||
} | ||
module lang::rascal::tests::library::Location | ||
|
||
import Location; | ||
|
||
test bool isOverlapping1() = isOverlapping(|unknown:///|(0, 2), |unknown:///|(0, 2)); | ||
test bool isOverlapping2() = isOverlapping(|unknown:///|(0, 2), |unknown:///|(1, 2)); | ||
test bool isOverlapping3() = !isOverlapping(|unknown:///|(0, 2), |unknown:///|(2, 2)); | ||
test bool isOverlapping4() = isOverlapping(|unknown:///|(1, 2), |unknown:///|(0, 2)); | ||
test bool isOverlapping5() = isOverlapping(|unknown:///|(1, 2), |unknown:///|(1, 2)); | ||
test bool isOverlapping6() = isOverlapping(|unknown:///|(1, 2), |unknown:///|(2, 2)); | ||
test bool isOverlapping7() = !isOverlapping(|unknown:///|(2, 2), |unknown:///|(0, 2)); | ||
test bool isOverlapping8() = isOverlapping(|unknown:///|(2, 2), |unknown:///|(1, 2)); | ||
test bool isOverlapping9() = isOverlapping(|unknown:///|(2, 2), |unknown:///|(2, 2)); |
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.
how about moving this to this already existing file with location tests?
rascal/src/org/rascalmpl/library/lang/rascal/tests/basic/Locations.rsc
Lines 437 to 448 in cbba43c
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.
Ok, sure, I'll do.
For future reference, though, which tests go in
lang::rascal::tests::basic::*
and which tests go inlang::rascal::tests::library::*
? I was assuming that tests related to language primitives would go inbasic::*
and tests for library functions inlibrary::*
, but I now also notice for instance:rascal/src/org/rascalmpl/library/lang/rascal/tests/basic/Booleans.rsc
Line 40 in 6fa3b43
And:
rascal/src/org/rascalmpl/library/lang/rascal/tests/library/Boolean.rsc
Lines 25 to 28 in 6fa3b43
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.
I have no good answer for this. Maybe @jurgenvinju or @PaulKlint remembers the reason for the split?
In general, I just look at where other functions from the same module are tested.
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.
I am the first to admit that this organization can (and should) be improved, but the ratio is this:
basic
,functionality
or one of the other more specialized directorieslibrary
As a consequence, tests for, say, locations can be found in two places. Not very good. The problem is that there are several dimensions that can be used to organize the tests:
In many cases there is overlap between the categories. Come up with a better organization and I will be happy to implement it.
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.
Ok, thanks for clarifying!