Skip to content

Commit

Permalink
Fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
HarutakaMatsumoto committed Jan 15, 2025
1 parent fc9186a commit 434ab6b
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 29 deletions.
14 changes: 2 additions & 12 deletions change_zoom_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,19 +116,14 @@ func testForXYF(
}

i := 0
theError = spatialIDBox.ForXYF(func(spatialID SpatialID) error {
for spatialID := range spatialIDBox.AllXYF() {
if i >= len(expected) {
t.Errorf("空間ID - 期待要素数:%v, 取得要素数:%v", len(expected), i)
}
if !reflect.DeepEqual(spatialID.String(), expected[i]) {
t.Errorf("空間ID - 期待値:%v, 取得値:%v", expected[i], spatialID.String())
}
i += 1
return nil
})

if theError != nil {
t.Error(theError)
}
}

Expand Down Expand Up @@ -532,19 +527,14 @@ func testTileXYZBoxAddZoomLevel(
}

i := 0
theError = tileXYZBox.ForXYZ(func(tile TileXYZ) error {
for tile := range tileXYZBox.AllXYZ() {
if i >= len(expected) {
t.Errorf("TileXYZ - 期待要素数:%v, 取得要素数:%v", len(expected), i)
}
if !reflect.DeepEqual(tile, *expected[i]) {
t.Errorf("TileXYZ - 期待値:%v, 取得値:%v", expected[i], tile)
}
i += 1
return nil
})

if theError != nil {
t.Error(theError)
}
}

Expand Down
37 changes: 28 additions & 9 deletions convert_quadkey_and_Vertical_id_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -213,15 +213,11 @@ func testNewSpatialIDBoxFromTileXYZBox(
spatialIDBox.AddZ(spatialIDZoomLevel-spatialIDBox.GetMin().GetZ())

i := 0
theError = spatialIDBox.ForXYF(func(id SpatialID) error {
for id := range spatialIDBox.AllXYF() {
if id.String() != expected[i] {
t.Fatal(id)
}
i += 1
return nil
})
if theError != nil {
t.Fatal(theError)
}
}

Expand Down Expand Up @@ -268,16 +264,40 @@ func TestConvertSpatialIdsToQuadkeysAndVerticalIDs_Max(t *testing.T) {
func TestConvertSpatialIdsToQuadkeysAndVerticalIDs_2(t *testing.T) {
testNewTileXYZBoxFromSpatialIDBox(
t,
// 21, [][2]int64{{29728048124, 2047}, {29728048125, 2047}, {29728048126, 2047}, {29728048127, 2047}}, 11, 500, 0
[]*TileXYZ{
{
quadkeyZoomLevel: 21,
altitudekeyZoomLevel: ,
altitudekeyZoomLevel: 11,
x: 170526,
y: 130846,

z: 2047, // Max
},
{
quadkeyZoomLevel: 21,
altitudekeyZoomLevel: 11,
x: 170527,
y: 130846,
z: 2047, // Max
},
{
quadkeyZoomLevel: 21,
altitudekeyZoomLevel: 11,
x: 170526,
y: 130847,
z: 2047, // Max
},
{
quadkeyZoomLevel: 21,
altitudekeyZoomLevel: 11,
x: 170527,
y: 130847,
z: 2047, // Max
},
},

"20/32768/85263/65423", // 32768 = 1 << 15

21, 11,
)
}

Expand Down Expand Up @@ -335,7 +355,6 @@ func TestConvertSpatialIdsToQuadkeysAndVerticalIDs(t *testing.T) {
e error
}{
// 正常
{spatialIds: []string{"20/56/85263/65423"}, ToHZoom: 21, ToVZoom: 11, maxHeight: 500, minHeight: 0.0, result: quadkeyAndVerticalIDsUpup, pattern: 0}, //all1
{spatialIds: []string{"20/56/85263/65423"}, ToHZoom: 19, ToVZoom: 9, maxHeight: 500, minHeight: 0.0, result: quadkeyAndVerticalIDsDwdw, pattern: 0}, //all1
{spatialIds: []string{"20/56/85263/65423"}, ToHZoom: 19, ToVZoom: 11, maxHeight: 500, minHeight: 0.0, result: quadkeyAndVerticalIDsDwup, pattern: 0}, //all1

Expand Down
11 changes: 3 additions & 8 deletions voxel_around_line_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,8 @@ func TestGetExtendedSpatialIdsWithinRadiusOfLine02_1(t *testing.T) {
}

count := 0
theError = tileXYZBox.ForCollisionWithConvexHull(convexHull, clearance, func(tile TileXYZ) error { // TODO: Rename ForXYZCollisionWithConvexHull
for _ = range tileXYZBox.AllCollisionWithConvexHull(convexHull, clearance) {
count += 1
return nil
})
if theError != nil {
t.Error(theError)
}

if count != expectedCount {
Expand Down Expand Up @@ -79,10 +75,9 @@ func TestGetExtendedSpatialIdsWithinRadiusOfLine02_2(t *testing.T) {
}

count := 0
theError = tileXYZBox.ForCollisionWithConvexHull(convexHull, clearance, func(tile TileXYZ) error {
for _ = range tileXYZBox.AllCollisionWithConvexHull(convexHull, clearance) {
count += 1
return nil
})
}

if count != expectedCount {
t.Errorf("Expected %v voxels, but got %v", expectedCount, count)
Expand Down

0 comments on commit 434ab6b

Please sign in to comment.