Skip to content

Commit bce7594

Browse files
committed
geo coodinate test追加
1 parent 2f3cd4b commit bce7594

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

test/test_geo_coordinate.cpp

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,29 @@ namespace plateau::geometry {
3434

3535
TEST_F(GeoCoordinateTest, CoordinateReference) { // NOLINT
3636

37-
ASSERT_EQ(8, CoordinateReferenceFactory::GetZoneId(10169));
37+
// 正常系テスト - EPSGから正しいゾーンIDが取得できること
38+
ASSERT_EQ(1, CoordinateReferenceFactory::GetZoneId(10162)); // 最小値
39+
ASSERT_EQ(8, CoordinateReferenceFactory::GetZoneId(10169)); // 中間値
40+
ASSERT_EQ(13, CoordinateReferenceFactory::GetZoneId(10174)); // 最大値
41+
42+
// 異常系テスト - 範囲外のEPSGでは0が返されること
43+
ASSERT_EQ(0, CoordinateReferenceFactory::GetZoneId(10161)); // 境界外(最小値-1)
44+
ASSERT_EQ(0, CoordinateReferenceFactory::GetZoneId(10175)); // 境界外(最大値+1)
45+
ASSERT_EQ(0, CoordinateReferenceFactory::GetZoneId(6697)); // 極座標系EPSG
46+
3847
ASSERT_FALSE(CoordinateReferenceFactory::IsPolarCoordinateSystem(10169));
3948
ASSERT_TRUE(CoordinateReferenceFactory::IsPolarCoordinateSystem(6697));
49+
ASSERT_TRUE(CoordinateReferenceFactory::IsPolarCoordinateSystem(4301)); // JGD2000
50+
ASSERT_TRUE(CoordinateReferenceFactory::IsPolarCoordinateSystem(0)); // 不明なEPSG
4051

4152
const auto& refPoint = CoordinateReferenceFactory::GetOriginPoint(10169);
4253
ASSERT_EQ(36.0, refPoint.latitude);
4354
ASSERT_EQ(138.5, refPoint.longitude);
55+
56+
// 無効なEPSGの場合、空のGeoCoordinateが返されること
57+
const auto & invalidRefPoint = CoordinateReferenceFactory::GetOriginPoint(0);
58+
ASSERT_EQ(0.0, invalidRefPoint.latitude);
59+
ASSERT_EQ(0.0, invalidRefPoint.longitude);
60+
ASSERT_EQ(0.0, invalidRefPoint.height);
4461
}
4562
}

0 commit comments

Comments
 (0)