Path: blob/main/unittest/src/netbuild/NBHeightMapperTest.cpp
169678 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 NBHeightMapperTest.cpp14/// @author Laura Bieker15/// @author Michael Behrisch16/// @date 2014-09-0917///18// Tests the class NBHeightMapper19/****************************************************************************/20#include <config.h>2122#include <gtest/gtest.h>23#include <netbuild/NBHeightMapper.h>2425class NBHeightMapperTest : public testing::Test {26protected :2728virtual void SetUp() {29NBHeightMapper& hm = NBHeightMapper::myInstance;30PositionVector t1;31t1.push_back(Position(0, 0, 0));32t1.push_back(Position(1, 0, 0));33t1.push_back(Position(0, 1, 0));34hm.addTriangle(t1);3536PositionVector t2;37t2.push_back(Position(1, 0, 1));38t2.push_back(Position(1, 1, 1));39t2.push_back(Position(0, 1, 1));40hm.addTriangle(t2);4142PositionVector t3;43t3.push_back(Position(1, 0, 0));44t3.push_back(Position(3, 0, 4));45t3.push_back(Position(1, 2, 4));46hm.addTriangle(t3);47}4849virtual void TearDown() {50NBHeightMapper& hm = NBHeightMapper::myInstance;51hm.clearData();52}53};5455/* Test the method 'getZ'*/56TEST_F(NBHeightMapperTest, test_method_getZ) {57const NBHeightMapper& hm = NBHeightMapper::get();58EXPECT_TRUE(hm.ready());59EXPECT_DOUBLE_EQ(0., hm.getZ(Position(0.25, 0.25)));60EXPECT_DOUBLE_EQ(1., hm.getZ(Position(0.75, 0.75)));61EXPECT_DOUBLE_EQ(2., hm.getZ(Position(1.5, 0.5)));62//EXPECT_DOUBLE_EQ(0.5, hm.getZ(Position(0.5, 0.5, 100)));63}646566