Addition of test code for location_bounds_contains_coordinates_on_edge() 48/239248/1
authorchakradhar pogiri <v.pogiri@samsung.com>
Thu, 23 Jul 2020 05:47:39 +0000 (11:17 +0530)
committerchakradhar pogiri <v.pogiri@samsung.com>
Thu, 23 Jul 2020 05:47:39 +0000 (11:17 +0530)
Change-Id: I04330b71c04bc82a49eef8c3fbe4d55fc6ada339

test/location_test.c

index 3fd29ae..fa7bac4 100755 (executable)
@@ -112,7 +112,11 @@ void location_bounds_test()
        location_coords_s center;
        center.latitude = 37.258;
        center.longitude = 127.056;
+       location_coords_s position;
+       position.latitude = 37.368;
+       position.longitude = 128.002;
        double radius = 30;
+       double tolerance = 40;
        location_bounds_h bounds_circle;
        ret = location_bounds_create_circle(center, radius, &bounds_circle);
        if (ret != LOCATION_BOUNDS_ERROR_NONE)
@@ -134,6 +138,10 @@ void location_bounds_test()
        } else
                fprintf(stderr, "location_bounds_get_circle_coords(center: %lf, %lf, radius: %lf) \n", center2.latitude,
                                center2.longitude, radius2);
+       if (location_bounds_contains_coordinates_on_edge(bounds_circle, position, tolerance))
+               fprintf(stderr, "location_bounds_contains_coordinates_on_edge() retrun TRUE \n");
+       else
+               fprintf(stderr, "location_bounds_contains_coordinates_on_edge() retrun FALSE \n");
 
        /*Add the rect bounds */
        location_coords_s left_top;
@@ -167,6 +175,11 @@ void location_bounds_test()
                fprintf(stderr, "location_bounds_get_rect_coords(left_top: %lf, %lf - right_bottom: %lf, %lf) \n", left_top2.latitude,
                                left_top2.longitude, right_bottom2.latitude, right_bottom2.longitude);
 
+       if (location_bounds_contains_coordinates_on_edge(bounds_rect, position, tolerance))
+               fprintf(stderr, "location_bounds_contains_coordinates_on_edge() retrun TRUE \n");
+       else
+               fprintf(stderr, "location_bounds_contains_coordinates_on_edge() retrun FALSE \n");
+
        /*Add the polygon bounds */
 
        int poly_size = 3;
@@ -205,6 +218,11 @@ void location_bounds_test()
        else
                fprintf(stderr, "location_bounds_contains_coordinates() retrun FALSE \n");
 
+       if (location_bounds_contains_coordinates_on_edge(bounds_poly, test_coords, tolerance))
+               fprintf(stderr, "location_bounds_contains_coordinates_on_edge() retrun TRUE \n");
+       else
+               fprintf(stderr, "location_bounds_contains_coordinates_on_edge() retrun FALSE \n");
+
        /*print current bounds */
        ret = location_manager_foreach_boundary(manager, __location_bounds_cb, (void *)manager);
        if (ret != LOCATIONS_ERROR_NONE)