Exemplo n.º 1
0
Heap* heap_constructor( int (*heap_compare_function)(void*, void*) ){
	Heap* heap = malloc(sizeof(Heap));
	heap->vector = vector_constructor();
	heap->size = 0;
	heap->heap_compare_function = heap_compare_function;
	heap->heap_print_function = NULL;
	return heap;
}
// Test all constructors to see if variables are set
// and default correctly
TEST_F(LidarObstacleTest, ContstructorMinWallLengthDefaultTest) {
    LidarObstacle empty_constructor;
    LidarObstacle min_length_constructor(50);
    LidarObstacle angle_distance_constructor(10, 20);
    LidarObstacle length_angle_constructor(51, 10, 20);
    LidarObstacle vector_constructor({Reading{10, 20}, Reading{30, 40}});
    LidarObstacle length_vector_constructor(52,
                                            {Reading{10, 20}, Reading{30, 40}});

    int default_min_wall_length = 1;
    EXPECT_EQ(default_min_wall_length, empty_constructor.getMinWallLength());
    EXPECT_EQ(50, min_length_constructor.getMinWallLength());
    EXPECT_EQ(default_min_wall_length,
              angle_distance_constructor.getMinWallLength());
    EXPECT_EQ(51, length_angle_constructor.getMinWallLength());
    EXPECT_EQ(default_min_wall_length, vector_constructor.getMinWallLength());
    EXPECT_EQ(52, length_vector_constructor.getMinWallLength());

    // CLion doesn't like these lines, but it compiles fine.
    EXPECT_EQ(NONE, empty_constructor.getObstacleType());
    EXPECT_EQ(NONE, min_length_constructor.getObstacleType());
}