LCOV - code coverage report
Current view: top level - unittest/src/netbuild - NBHeightMapperTest.cpp (source / functions) Coverage Total Hit
Test: lcov.info Lines: 100.0 % 28 28
Test Date: 2025-12-06 15:35:27 Functions: 100.0 % 3 3

            Line data    Source code
       1              : /****************************************************************************/
       2              : // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo
       3              : // Copyright (C) 2001-2025 German Aerospace Center (DLR) and others.
       4              : // This program and the accompanying materials are made available under the
       5              : // terms of the Eclipse Public License 2.0 which is available at
       6              : // https://www.eclipse.org/legal/epl-2.0/
       7              : // This Source Code may also be made available under the following Secondary
       8              : // Licenses when the conditions for such availability set forth in the Eclipse
       9              : // Public License 2.0 are satisfied: GNU General Public License, version 2
      10              : // or later which is available at
      11              : // https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html
      12              : // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later
      13              : /****************************************************************************/
      14              : /// @file    NBHeightMapperTest.cpp
      15              : /// @author  Laura Bieker
      16              : /// @author  Michael Behrisch
      17              : /// @date    2014-09-09
      18              : ///
      19              : // Tests the class NBHeightMapper
      20              : /****************************************************************************/
      21              : #include <config.h>
      22              : 
      23              : #include <gtest/gtest.h>
      24              : #include <netbuild/NBHeightMapper.h>
      25              : 
      26            1 : class NBHeightMapperTest : public testing::Test {
      27              : protected :
      28              : 
      29            1 :     virtual void SetUp() {
      30              :         NBHeightMapper& hm = NBHeightMapper::myInstance;
      31            1 :         PositionVector t1;
      32            1 :         t1.push_back(Position(0, 0, 0));
      33            1 :         t1.push_back(Position(1, 0, 0));
      34            1 :         t1.push_back(Position(0, 1, 0));
      35            1 :         hm.addTriangle(t1);
      36              : 
      37            1 :         PositionVector t2;
      38            1 :         t2.push_back(Position(1, 0, 1));
      39            1 :         t2.push_back(Position(1, 1, 1));
      40            1 :         t2.push_back(Position(0, 1, 1));
      41            1 :         hm.addTriangle(t2);
      42              : 
      43            1 :         PositionVector t3;
      44            1 :         t3.push_back(Position(1, 0, 0));
      45            1 :         t3.push_back(Position(3, 0, 4));
      46            1 :         t3.push_back(Position(1, 2, 4));
      47            1 :         hm.addTriangle(t3);
      48            1 :     }
      49              : 
      50            1 :     virtual void TearDown() {
      51              :         NBHeightMapper& hm = NBHeightMapper::myInstance;
      52            1 :         hm.clearData();
      53            1 :     }
      54              : };
      55              : 
      56              : /* Test the method 'getZ'*/
      57            1 : TEST_F(NBHeightMapperTest, test_method_getZ) {
      58            1 :     const NBHeightMapper& hm = NBHeightMapper::get();
      59            1 :     EXPECT_TRUE(hm.ready());
      60            1 :     EXPECT_DOUBLE_EQ(0., hm.getZ(Position(0.25, 0.25)));
      61            1 :     EXPECT_DOUBLE_EQ(1., hm.getZ(Position(0.75, 0.75)));
      62            1 :     EXPECT_DOUBLE_EQ(2., hm.getZ(Position(1.5, 0.5)));
      63              :     //EXPECT_DOUBLE_EQ(0.5, hm.getZ(Position(0.5, 0.5, 100)));
      64            1 : }
        

Generated by: LCOV version 2.0-1