main.cpp
Go to the documentation of this file.
1 // Copyright 2017 Open Source Robotics Foundation, Inc.
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 
15 #include <gtest/gtest.h>
16 
17 #include "vision_msgs/BoundingBox2D.h"
18 #include "vision_msgs/BoundingBox3D.h"
20 
21 TEST(vision_msgs, CreateAABB2D)
22 {
23  vision_msgs::BoundingBox2D bbox = vision_msgs::createAABB2D(1,2,3,4);
24  EXPECT_FLOAT_EQ(bbox.center.x, 2.5); // 1 + 3/2
25  EXPECT_FLOAT_EQ(bbox.center.y, 4); // 2 + 4/2
26  EXPECT_EQ(bbox.size_x, 3);
27  EXPECT_EQ(bbox.size_y, 4);
28  EXPECT_EQ(bbox.center.theta, 0);
29 }
30 
31 TEST(vision_msgs, CreateAABB3D)
32 {
33  vision_msgs::BoundingBox3D bbox = vision_msgs::createAABB3D(1,2,3,4,5,6);
34  EXPECT_FLOAT_EQ(bbox.center.position.x, 3); // 1 + 4/2
35  EXPECT_FLOAT_EQ(bbox.center.position.y, 4.5); // 2 + 5/2
36  EXPECT_FLOAT_EQ(bbox.center.position.z, 6); // 3 + 6/2
37  EXPECT_EQ(bbox.center.orientation.x, 0);
38  EXPECT_EQ(bbox.center.orientation.y, 0);
39  EXPECT_EQ(bbox.center.orientation.z, 0);
40  EXPECT_EQ(bbox.center.orientation.w, 1);
41  EXPECT_EQ(bbox.size.x, 4);
42  EXPECT_EQ(bbox.size.y, 5);
43  EXPECT_EQ(bbox.size.z, 6);
44 }
45 
46 int main(int argc, char** argv)
47 {
48  ::testing::InitGoogleTest(&argc, argv);
49  return RUN_ALL_TESTS();
50 }
static BoundingBox3D createAABB3D(uint32_t min_x, uint32_t min_y, uint32_t min_z, uint32_t size_x, uint32_t size_y, uint32_t size_z)
Definition: create_aabb.h:48
TEST(vision_msgs, CreateAABB2D)
Definition: main.cpp:21
int main(int argc, char **argv)
Definition: main.cpp:46
static BoundingBox2D createAABB2D(uint32_t left, uint32_t top, uint32_t width, uint32_t height)
Definition: create_aabb.h:28


vision_msgs
Author(s): Adam Allevato
autogenerated on Fri Dec 11 2020 03:27:33