From 627ba8a926da5fe6767c1d25f35ddba5282a7e82 Mon Sep 17 00:00:00 2001 From: chakradhar pogiri Date: Thu, 23 Jul 2020 11:17:39 +0530 Subject: [PATCH] Addition of test code for location_bounds_contains_coordinates_on_edge() Change-Id: I04330b71c04bc82a49eef8c3fbe4d55fc6ada339 --- test/location_test.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/test/location_test.c b/test/location_test.c index 3fd29ae..fa7bac4 100755 --- a/test/location_test.c +++ b/test/location_test.c @@ -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) -- 2.7.4