Path: blob/main/unittest/src/utils/geom/GeoConvHelperTest.cpp
169684 views
/****************************************************************************/1// Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo2// Copyright (C) 2001-2025 German Aerospace Center (DLR) and others.3// This program and the accompanying materials are made available under the4// terms of the Eclipse Public License 2.0 which is available at5// https://www.eclipse.org/legal/epl-2.0/6// This Source Code may also be made available under the following Secondary7// Licenses when the conditions for such availability set forth in the Eclipse8// Public License 2.0 are satisfied: GNU General Public License, version 29// or later which is available at10// https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html11// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later12/****************************************************************************/13/// @file GeoConvHelperTest.cpp14/// @author Jakob Erdmann15/// @author Laura Bieker16/// @date 2011-09-2317///18// Tests the class GeoConvHelper19/****************************************************************************/20#include <config.h>2122#include <gtest/gtest.h>23#include <utils/geom/GeoConvHelper.h>2425/*26Tests the class GeoConvHelper27*/282930/* Test the method 'x2cartesian' */31TEST(GeoConvHelper, test_method_x2cartesian) {32GeoConvHelper gch(33"+proj=utm +zone=33 +ellps=WGS84 +datum=WGS84 +units=m +no_defs",34Position(), Boundary(), Boundary(), 1, false);3536Position pos(13.5326994, 52.428098100000007);37gch.x2cartesian(pos);3839EXPECT_NEAR(400235.50494557252, pos.x(), 1e-5);40EXPECT_NEAR(5809666.826070101, pos.y(), 1e-5);41}4243/* Test the method 'cartesian2geo' */44TEST(GeoConvHelper, test_method_cartesian2geo) {45GeoConvHelper gch(46"+proj=utm +zone=33 +ellps=WGS84 +datum=WGS84 +units=m +no_defs",47Position(), Boundary(), Boundary(), 1, false);4849// Use the outputs of the `x2cartesian` test - hence making the combination of tests circular: geo -> cartesian -> geo50Position cartesian(400235.50494557252, 5809666.826070101);51gch.cartesian2geo(cartesian);5253EXPECT_NEAR(13.5326994, cartesian.x(), 1e-5);54EXPECT_NEAR(52.428098100000007, cartesian.y(), 1e-5);55}565758