-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for a Quantized Mesh DTM (Digital Terrain Model) collecti…
…on to OGC API GeoVolumes - allow the same collection to both contain 3D Tiles + DTM
- Loading branch information
1 parent
1ec49cf
commit 58bc28e
Showing
11 changed files
with
283 additions
and
70 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,161 @@ | ||
package engine | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
func TestGeoSpatialCollections_Unique(t *testing.T) { | ||
tests := []struct { | ||
name string | ||
g GeoSpatialCollections | ||
want []GeoSpatialCollection | ||
}{ | ||
{ | ||
name: "empty input", | ||
g: nil, | ||
want: []GeoSpatialCollection{}, | ||
}, | ||
{ | ||
name: "no dups, sorted by id", | ||
g: []GeoSpatialCollection{ | ||
{ | ||
ID: "3", | ||
}, | ||
{ | ||
ID: "1", | ||
}, | ||
{ | ||
ID: "1", | ||
}, | ||
{ | ||
ID: "2", | ||
}, | ||
}, | ||
want: []GeoSpatialCollection{ | ||
{ | ||
ID: "1", | ||
}, | ||
{ | ||
ID: "2", | ||
}, | ||
{ | ||
ID: "3", | ||
}, | ||
}, | ||
}, | ||
{ | ||
name: "no dups, sorted by title", | ||
g: []GeoSpatialCollection{ | ||
{ | ||
ID: "3", | ||
Metadata: &GeoSpatialCollectionMetadata{ | ||
Title: ptrTo("a"), | ||
LastUpdatedBy: "", | ||
}, | ||
}, | ||
{ | ||
ID: "1", | ||
Metadata: &GeoSpatialCollectionMetadata{ | ||
Title: ptrTo("c"), | ||
LastUpdatedBy: "", | ||
}, | ||
}, | ||
{ | ||
ID: "3", | ||
Metadata: &GeoSpatialCollectionMetadata{ | ||
Title: ptrTo("a"), | ||
LastUpdatedBy: "", | ||
}, | ||
}, | ||
{ | ||
ID: "2", | ||
Metadata: &GeoSpatialCollectionMetadata{ | ||
Title: ptrTo("b"), | ||
LastUpdatedBy: "", | ||
}, | ||
}, | ||
}, | ||
want: []GeoSpatialCollection{ | ||
{ | ||
ID: "3", | ||
Metadata: &GeoSpatialCollectionMetadata{ | ||
Title: ptrTo("a"), | ||
LastUpdatedBy: "", | ||
}, | ||
}, | ||
{ | ||
ID: "2", | ||
Metadata: &GeoSpatialCollectionMetadata{ | ||
Title: ptrTo("b"), | ||
LastUpdatedBy: "", | ||
}, | ||
}, | ||
{ | ||
ID: "1", | ||
Metadata: &GeoSpatialCollectionMetadata{ | ||
Title: ptrTo("c"), | ||
LastUpdatedBy: "", | ||
}, | ||
}, | ||
}, | ||
}, | ||
} | ||
for _, tt := range tests { | ||
t.Run(tt.name, func(t *testing.T) { | ||
assert.Equalf(t, tt.want, tt.g.Unique(), "Unique()") | ||
}) | ||
} | ||
} | ||
|
||
func TestGeoSpatialCollections_ContainsID(t *testing.T) { | ||
tests := []struct { | ||
name string | ||
g GeoSpatialCollections | ||
id string | ||
want bool | ||
}{ | ||
{ | ||
name: "ID is present", | ||
g: []GeoSpatialCollection{ | ||
{ | ||
ID: "3", | ||
}, | ||
{ | ||
ID: "1", | ||
}, | ||
{ | ||
ID: "2", | ||
}, | ||
}, | ||
id: "1", | ||
want: true, | ||
}, | ||
{ | ||
name: "ID is not present", | ||
g: []GeoSpatialCollection{ | ||
{ | ||
ID: "3", | ||
}, | ||
{ | ||
ID: "1", | ||
}, | ||
{ | ||
ID: "2", | ||
}, | ||
}, | ||
id: "55", | ||
want: false, | ||
}, | ||
} | ||
for _, tt := range tests { | ||
t.Run(tt.name, func(t *testing.T) { | ||
assert.Equalf(t, tt.want, tt.g.ContainsID(tt.id), "ContainsID(%v)", tt.id) | ||
}) | ||
} | ||
} | ||
|
||
func ptrTo[T any](val T) *T { | ||
return &val | ||
} |
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
Oops, something went wrong.