-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[uss_qualifier] DSS0030 slight overlap subscription interactions
- Loading branch information
Showing
6 changed files
with
125 additions
and
0 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
from typing import List, Tuple | ||
|
||
from s2sphere import LatLng | ||
|
||
from monitoring.monitorlib.geo import generate_slight_overlap_area | ||
|
||
|
||
def _points(in_points: List[Tuple[float, float]]) -> List[LatLng]: | ||
return [LatLng.from_degrees(*p) for p in in_points] | ||
|
||
|
||
def test_generate_slight_overlap_area(): | ||
# Square around 0,0 of edge length 2 -> first corner at 1,1 -> expect a square with overlapping corner at 1,1 | ||
assert generate_slight_overlap_area( | ||
_points([(1, 1), (1, -1), (-1, -1), (-1, 1)]) | ||
) == _points([(1, 1), (1, 2), (2, 2), (2, 1)]) | ||
|
||
# Square with diagonal from 0,0 to 1,1 -> first corner at 1,1 -> expect a square with overlapping corner at 1,1 | ||
assert generate_slight_overlap_area( | ||
_points([(1, 1), (0, 1), (0, 0), (1, 0)]) | ||
) == _points([(1, 1), (1, 1.5), (1.5, 1.5), (1.5, 1)]) | ||
|
||
# Square with diagonal from 0,0 to -1,-1 -> first corner at -1,-1 -> expect a square with overlapping corner at -1,-1 | ||
assert generate_slight_overlap_area( | ||
_points([(-1, -1), (0, -1), (0, 0), (-1, 0)]) | ||
) == _points([(-1, -1), (-1, -1.5), (-1.5, -1.5), (-1.5, -1)]) | ||
|
||
# Square with diagonal from 0,0 to -1,1 -> first corner at -1,1 -> expect a square with overlapping corner at -1,0 | ||
assert generate_slight_overlap_area( | ||
_points([(-1, 1), (-1, 0), (0, 0), (0, 1)]) | ||
) == _points([(-1, 1), (-1, 1.5), (-1.5, 1.5), (-1.5, 1)]) | ||
|
||
# Square with diagonal from 0,0 to 1,-1 -> first corner at 1,-1 -> expect a square with overlapping corner at 1,-1 | ||
assert generate_slight_overlap_area( | ||
_points([(1, -1), (1, 0), (0, 0), (0, -1)]) | ||
) == _points([(1, -1), (1, -1.5), (1.5, -1.5), (1.5, -1)]) |
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
2 changes: 2 additions & 0 deletions
2
monitoring/uss_qualifier/scenarios/astm/netrid/common/dss/utils.py
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