CARLA
Loading...
Searching...
No Matches
test_vector3D.cpp
Go to the documentation of this file.
1// Copyright (c) 2026 Computer Vision Center (CVC) at the Universitat Autonoma
2// de Barcelona (UAB).
3//
4// This work is licensed under the terms of the MIT license.
5// For a copy, see <https://opensource.org/licenses/MIT>.
6
7#include "test.h"
8
10#include <carla/geom/Math.h>
11
12using namespace carla::geom;
13
14TEST(vector3D, make_unit_vec) {
15 ASSERT_EQ(Vector3D(10,0,0).MakeUnitVector(), Vector3D(1,0,0));
16 ASSERT_NE(Vector3D(10,0,0).MakeUnitVector(), Vector3D(0,1,0));
17 ASSERT_EQ(Vector3D(0,10,0).MakeUnitVector(), Vector3D(0,1,0));
18 ASSERT_EQ(Vector3D(0,0,512).MakeUnitVector(), Vector3D(0,0,1));
19 ASSERT_NE(Vector3D(0,1,512).MakeUnitVector(), Vector3D(0,0,1));
20
21 // The following test is to check that the MakeUnitVector doesn't fail on zero-length vectors
22 ASSERT_EQ(Vector3D().MakeUnitVector(), Vector3D(0,0,0));
23}
TEST(agents_types, road_option_values_match_python)