From d3e7b4182a9b2b0d0f17cc796e8fd6aea5d0de94 Mon Sep 17 00:00:00 2001 From: Minjune Kim Date: Tue, 21 Aug 2012 18:14:46 +0900 Subject: [PATCH] Release Tizen2.0 beta --- TC/_export_env.sh | 8 + TC/_export_target_env.sh | 8 + TC/build.sh | 16 + TC/clean.sh | 11 + TC/config | 2 + TC/execute.sh | 15 + TC/testcase/Makefile | 25 + TC/testcase/tslist | 3 + TC/testcase/utc_location_route.c | 1236 ++++++++++++++++++++++ TC/testcase/utc_location_route_preference.c | 1500 +++++++++++++++++++++++++++ TC/testcase/utc_location_route_service.c | 295 ++++++ TC/tet_scen | 7 + TC/tetbuild.cfg | 5 + TC/tetclean.cfg | 5 + TC/tetexec.cfg | 5 + debian/changelog | 24 +- include/route_private.h | 3 +- packaging/capi-location-route.spec | 2 +- src/route_preference.c | 40 +- src/route_service.c | 11 +- 20 files changed, 3190 insertions(+), 31 deletions(-) create mode 100755 TC/_export_env.sh create mode 100755 TC/_export_target_env.sh create mode 100755 TC/build.sh create mode 100755 TC/clean.sh create mode 100644 TC/config create mode 100755 TC/execute.sh create mode 100755 TC/testcase/Makefile create mode 100644 TC/testcase/tslist create mode 100644 TC/testcase/utc_location_route.c create mode 100644 TC/testcase/utc_location_route_preference.c create mode 100644 TC/testcase/utc_location_route_service.c create mode 100755 TC/tet_scen create mode 100644 TC/tetbuild.cfg create mode 100644 TC/tetclean.cfg create mode 100644 TC/tetexec.cfg diff --git a/TC/_export_env.sh b/TC/_export_env.sh new file mode 100755 index 0000000..72a11ec --- /dev/null +++ b/TC/_export_env.sh @@ -0,0 +1,8 @@ +#!/bin/sh + +. ./config +export TET_INSTALL_PATH=$TET_INSTALL_HOST_PATH # tetware root path +export TET_TARGET_PATH=$TET_INSTALL_PATH/tetware-target # tetware target path +export PATH=$TET_TARGET_PATH/bin:$PATH +export LD_LIBRARY_PATH=$TET_TARGET_PATH/lib/tet3:$LD_LIBRARY_PATH +export TET_ROOT=$TET_TARGET_PATH diff --git a/TC/_export_target_env.sh b/TC/_export_target_env.sh new file mode 100755 index 0000000..6c0fb90 --- /dev/null +++ b/TC/_export_target_env.sh @@ -0,0 +1,8 @@ +#!/bin/sh + +. ./config +export TET_INSTALL_PATH=$TET_INSTALL_TARGET_PATH # path to path +export TET_TARGET_PATH=$TET_INSTALL_PATH/tetware-target +export PATH=$TET_TARGET_PATH/bin:$PATH +export LD_LIBRARY_PATH=$TET_TARGET_PATH/lib/tet3:$LD_LIBRARY_PATH +export TET_ROOT=$TET_TARGET_PATH diff --git a/TC/build.sh b/TC/build.sh new file mode 100755 index 0000000..72aad6c --- /dev/null +++ b/TC/build.sh @@ -0,0 +1,16 @@ +#!/bin/sh + +. ./_export_env.sh # setting environment variables + +export TET_SUITE_ROOT=`pwd` +FILE_NAME_EXTENSION=`date +%s` + +RESULT_DIR=results +HTML_RESULT=$RESULT_DIR/build-tar-result-$FILE_NAME_EXTENSION.html +JOURNAL_RESULT=$RESULT_DIR/build-tar-result-$FILE_NAME_EXTENSION.journal + +mkdir -p $RESULT_DIR + +tcc -c -p ./ +tcc -b -j $JOURNAL_RESULT -p ./ +grw -c 7 -f chtml -o $HTML_RESULT $JOURNAL_RESULT diff --git a/TC/clean.sh b/TC/clean.sh new file mode 100755 index 0000000..29743e0 --- /dev/null +++ b/TC/clean.sh @@ -0,0 +1,11 @@ +#!/bin/sh + +. ./_export_env.sh # setting environment variables + +export TET_SUITE_ROOT=`pwd` +RESULT_DIR=results + +tcc -c -p ./ # executing tcc, with clean option (-c) +rm -r $RESULT_DIR +rm -r tet_tmp_dir +rm testcase/tet_captured diff --git a/TC/config b/TC/config new file mode 100644 index 0000000..f1d32c9 --- /dev/null +++ b/TC/config @@ -0,0 +1,2 @@ +TET_INSTALL_HOST_PATH=/home/genie/git/tool/tetware/TETware +TET_INSTALL_TARGET_PATH=/mnt/nfs/tool/tetware/TETware diff --git a/TC/execute.sh b/TC/execute.sh new file mode 100755 index 0000000..a4f6095 --- /dev/null +++ b/TC/execute.sh @@ -0,0 +1,15 @@ +#!/bin/sh + +. ./_export_target_env.sh # setting environment variables + +export TET_SUITE_ROOT=`pwd` +FILE_NAME_EXTENSION=`date +%s` + +RESULT_DIR=results +HTML_RESULT=$RESULT_DIR/exec-tar-result-$FILE_NAME_EXTENSION.html +JOURNAL_RESULT=$RESULT_DIR/exec-tar-result-$FILE_NAME_EXTENSION.journal + +mkdir -p $RESULT_DIR + +tcc -e -j $JOURNAL_RESULT -p ./ +grw -c 3 -f chtml -o $HTML_RESULT $JOURNAL_RESULT diff --git a/TC/testcase/Makefile b/TC/testcase/Makefile new file mode 100755 index 0000000..0dd875c --- /dev/null +++ b/TC/testcase/Makefile @@ -0,0 +1,25 @@ +CC ?= gcc + +C_FILES = $(shell ls *.c) + +PKGS = capi-location-route dlog glib-2.0 gthread-2.0 + +LDFLAGS = `pkg-config --libs $(PKGS)` +LDFLAGS += $(TET_ROOT)/lib/tet3/tcm_s.o +LDFLAGS += -L$(TET_ROOT)/lib/tet3 -ltcm_s +LDFLAGS += -L$(TET_ROOT)/lib/tet3 -lapi_s + +CFLAGS = -I. `pkg-config --cflags $(PKGS)` +CFLAGS += -I$(TET_ROOT)/inc/tet3 +CFLAGS += -Wall + +#TARGETS = $(C_FILES:%.c=tc-%) +TCS := $(shell ls -1 *.c | cut -d. -f1) + +all: $(TCS) + +%: %.c + $(CC) -o $@ $< $(CFLAGS) $(LDFLAGS) + +clean: + rm -f $(TCS) diff --git a/TC/testcase/tslist b/TC/testcase/tslist new file mode 100644 index 0000000..6199c07 --- /dev/null +++ b/TC/testcase/tslist @@ -0,0 +1,3 @@ +/testcase/utc_location_route_service +/testcase/utc_location_route_preference +/testcase/utc_location_route diff --git a/TC/testcase/utc_location_route.c b/TC/testcase/utc_location_route.c new file mode 100644 index 0000000..43a5035 --- /dev/null +++ b/TC/testcase/utc_location_route.c @@ -0,0 +1,1236 @@ +/* +* Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +#include + +#include +#include +#include +#include + +enum { + POSITIVE_TC_IDX = 0x01, + NEGATIVE_TC_IDX, +}; + +static void startup(void); +static void cleanup(void); + +void (*tet_startup) (void) = startup; +void (*tet_cleanup) (void) = cleanup; + +static void utc_location_route_clone_p(void); +static void utc_location_route_clone_n(void); +static void utc_location_route_destroy_p(void); +static void utc_location_route_destroy_n(void); +static void utc_location_route_get_request_id_p(void); +static void utc_location_route_get_request_id_n(void); +static void utc_location_route_get_request_id_n_02(void); +static void utc_location_route_get_origin_p(void); +static void utc_location_route_get_origin_n(void); +static void utc_location_route_get_origin_n_02(void); +static void utc_location_route_get_destination_p(void); +static void utc_location_route_get_destination_n(void); +static void utc_location_route_get_destination_n_02(void); +static void utc_location_route_get_geometry_bounding_box_p(void); +static void utc_location_route_get_geometry_bounding_box_n(void); +static void utc_location_route_get_geometry_bounding_box_n_02(void); +static void utc_location_route_get_geometry_bounding_box_n_03(void); +static void utc_location_route_get_distance_unit_p(void); +static void utc_location_route_get_distance_unit_n(void); +static void utc_location_route_get_distance_unit_n_02(void); +static void utc_location_route_get_total_distance_p(void); +static void utc_location_route_get_total_distance_n(void); +static void utc_location_route_get_total_distance_n_02(void); +static void utc_location_route_get_total_duration_p(void); +static void utc_location_route_get_total_duration_n(void); +static void utc_location_route_get_total_duration_n_02(void); +static void utc_location_route_foreach_properties_p(void); +static void utc_location_route_foreach_properties_n(void); +static void utc_location_route_foreach_properties_n_02(void); +static void utc_location_route_foreach_segments_p(void); +static void utc_location_route_foreach_segments_n(void); +static void utc_location_route_foreach_segments_n_02(void); +static void utc_location_route_segment_clone_p(void); +static void utc_location_route_segment_clone_n(void); +static void utc_location_route_segment_destroy_p(void); +static void utc_location_route_segment_destroy_n(void); +static void utc_location_route_segment_get_origin_p(void); +static void utc_location_route_segment_get_origin_n(void); +static void utc_location_route_segment_get_origin_n_02(void); +static void utc_location_route_segment_get_destination_p(void); +static void utc_location_route_segment_get_destination_n(void); +static void utc_location_route_segment_get_destination_n_02(void); +static void utc_location_route_segment_get_geometry_bounding_box_p(void); +static void utc_location_route_segment_get_geometry_bounding_box_n(void); +static void utc_location_route_segment_get_geometry_bounding_box_n_02(void); +static void utc_location_route_segment_get_geometry_bounding_box_n_03(void); +static void utc_location_route_segment_get_distance_p(void); +static void utc_location_route_segment_get_distance_n(void); +static void utc_location_route_segment_get_distance_n_02(void); +static void utc_location_route_segment_get_duration_p(void); +static void utc_location_route_segment_get_duration_n(void); +static void utc_location_route_segment_get_duration_n_02(void); +static void utc_location_route_segment_foreach_properties_p(void); +static void utc_location_route_segment_foreach_properties_n(void); +static void utc_location_route_segment_foreach_properties_n_02(void); +static void utc_location_route_segment_foreach_steps_p(void); +static void utc_location_route_segment_foreach_steps_n(void); +static void utc_location_route_segment_foreach_steps_n_02(void); +static void utc_location_route_step_clone_p(void); +static void utc_location_route_step_clone_n(void); +static void utc_location_route_step_destroy_p(void); +static void utc_location_route_step_destroy_n(void); +static void utc_location_route_step_get_origin_p(void); +static void utc_location_route_step_get_origin_n(void); +static void utc_location_route_step_get_origin_n_02(void); +static void utc_location_route_step_get_destination_p(void); +static void utc_location_route_step_get_destination_n(void); +static void utc_location_route_step_get_destination_n_02(void); +static void utc_location_route_step_get_geometry_bounding_box_p(void); +static void utc_location_route_step_get_geometry_bounding_box_n(void); +static void utc_location_route_step_get_geometry_bounding_box_n_02(void); +static void utc_location_route_step_get_geometry_bounding_box_n_03(void); +static void utc_location_route_step_get_distance_p(void); +static void utc_location_route_step_get_distance_n(void); +static void utc_location_route_step_get_distance_n_02(void); +static void utc_location_route_step_get_duration_p(void); +static void utc_location_route_step_get_duration_n(void); +static void utc_location_route_step_get_duration_n_02(void); +static void utc_location_route_step_get_transport_mode_p(void); +static void utc_location_route_step_get_transport_mode_n(void); +static void utc_location_route_step_get_transport_mode_n_02(void); +static void utc_location_route_step_get_instruction_p(void); +static void utc_location_route_step_get_instruction_n(void); +static void utc_location_route_step_get_instruction_n_02(void); +static void utc_location_route_step_foreach_geometries_p(void); +static void utc_location_route_step_foreach_geometries_n(void); +static void utc_location_route_step_foreach_geometries_n_02(void); +static void utc_location_route_step_foreach_properties_p(void); +static void utc_location_route_step_foreach_properties_n(void); +static void utc_location_route_step_foreach_properties_n_02(void); + +struct tet_testlist tet_testlist[] = { + {utc_location_route_clone_p, POSITIVE_TC_IDX}, + {utc_location_route_clone_n, NEGATIVE_TC_IDX}, + {utc_location_route_destroy_p, POSITIVE_TC_IDX}, + {utc_location_route_destroy_n, NEGATIVE_TC_IDX}, + {utc_location_route_get_request_id_p, POSITIVE_TC_IDX}, + {utc_location_route_get_request_id_n, NEGATIVE_TC_IDX}, + {utc_location_route_get_request_id_n_02, NEGATIVE_TC_IDX}, + {utc_location_route_get_origin_p, POSITIVE_TC_IDX}, + {utc_location_route_get_origin_n, NEGATIVE_TC_IDX}, + {utc_location_route_get_origin_n_02, NEGATIVE_TC_IDX}, + {utc_location_route_get_destination_p, POSITIVE_TC_IDX}, + {utc_location_route_get_destination_n, NEGATIVE_TC_IDX}, + {utc_location_route_get_destination_n_02, NEGATIVE_TC_IDX}, + {utc_location_route_get_geometry_bounding_box_p, POSITIVE_TC_IDX}, + {utc_location_route_get_geometry_bounding_box_n, NEGATIVE_TC_IDX}, + {utc_location_route_get_geometry_bounding_box_n_02, NEGATIVE_TC_IDX}, + {utc_location_route_get_geometry_bounding_box_n_03, NEGATIVE_TC_IDX}, + {utc_location_route_get_distance_unit_p, POSITIVE_TC_IDX}, + {utc_location_route_get_distance_unit_n, NEGATIVE_TC_IDX}, + {utc_location_route_get_distance_unit_n_02, NEGATIVE_TC_IDX}, + {utc_location_route_get_total_distance_p, POSITIVE_TC_IDX}, + {utc_location_route_get_total_distance_n, NEGATIVE_TC_IDX}, + {utc_location_route_get_total_distance_n_02, NEGATIVE_TC_IDX}, + {utc_location_route_get_total_duration_p, POSITIVE_TC_IDX}, + {utc_location_route_get_total_duration_n, NEGATIVE_TC_IDX}, + {utc_location_route_get_total_duration_n_02, NEGATIVE_TC_IDX}, + {utc_location_route_foreach_properties_p, POSITIVE_TC_IDX}, + {utc_location_route_foreach_properties_n, NEGATIVE_TC_IDX}, + {utc_location_route_foreach_properties_n_02, NEGATIVE_TC_IDX}, + {utc_location_route_foreach_segments_p, POSITIVE_TC_IDX}, + {utc_location_route_foreach_segments_n, NEGATIVE_TC_IDX}, + {utc_location_route_foreach_segments_n_02, NEGATIVE_TC_IDX}, + {utc_location_route_segment_clone_p, POSITIVE_TC_IDX}, + {utc_location_route_segment_clone_n, NEGATIVE_TC_IDX}, + {utc_location_route_segment_destroy_p, POSITIVE_TC_IDX}, + {utc_location_route_segment_destroy_n, NEGATIVE_TC_IDX}, + {utc_location_route_segment_get_origin_p, POSITIVE_TC_IDX}, + {utc_location_route_segment_get_origin_n, NEGATIVE_TC_IDX}, + {utc_location_route_segment_get_origin_n_02, NEGATIVE_TC_IDX}, + {utc_location_route_segment_get_destination_p, POSITIVE_TC_IDX}, + {utc_location_route_segment_get_destination_n, NEGATIVE_TC_IDX}, + {utc_location_route_segment_get_destination_n_02, NEGATIVE_TC_IDX}, + {utc_location_route_segment_get_geometry_bounding_box_p, POSITIVE_TC_IDX}, + {utc_location_route_segment_get_geometry_bounding_box_n, NEGATIVE_TC_IDX}, + {utc_location_route_segment_get_geometry_bounding_box_n_02, NEGATIVE_TC_IDX}, + {utc_location_route_segment_get_geometry_bounding_box_n_03, NEGATIVE_TC_IDX}, + {utc_location_route_segment_get_distance_p, POSITIVE_TC_IDX}, + {utc_location_route_segment_get_distance_n, NEGATIVE_TC_IDX}, + {utc_location_route_segment_get_distance_n_02, NEGATIVE_TC_IDX}, + {utc_location_route_segment_get_duration_p, POSITIVE_TC_IDX}, + {utc_location_route_segment_get_duration_n, NEGATIVE_TC_IDX}, + {utc_location_route_segment_get_duration_n_02, NEGATIVE_TC_IDX}, + {utc_location_route_segment_foreach_properties_p, POSITIVE_TC_IDX}, + {utc_location_route_segment_foreach_properties_n, NEGATIVE_TC_IDX}, + {utc_location_route_segment_foreach_properties_n_02, NEGATIVE_TC_IDX}, + {utc_location_route_segment_foreach_steps_p, POSITIVE_TC_IDX}, + {utc_location_route_segment_foreach_steps_n, NEGATIVE_TC_IDX}, + {utc_location_route_segment_foreach_steps_n_02, NEGATIVE_TC_IDX}, + {utc_location_route_step_clone_p, POSITIVE_TC_IDX}, + {utc_location_route_step_clone_n, NEGATIVE_TC_IDX}, + {utc_location_route_step_destroy_p, POSITIVE_TC_IDX}, + {utc_location_route_step_destroy_n, NEGATIVE_TC_IDX}, + {utc_location_route_step_get_origin_p, POSITIVE_TC_IDX}, + {utc_location_route_step_get_origin_n, NEGATIVE_TC_IDX}, + {utc_location_route_step_get_origin_n_02, NEGATIVE_TC_IDX}, + {utc_location_route_step_get_destination_p, POSITIVE_TC_IDX}, + {utc_location_route_step_get_destination_n, NEGATIVE_TC_IDX}, + {utc_location_route_step_get_destination_n_02, NEGATIVE_TC_IDX}, + {utc_location_route_step_get_geometry_bounding_box_p, POSITIVE_TC_IDX}, + {utc_location_route_step_get_geometry_bounding_box_n, NEGATIVE_TC_IDX}, + {utc_location_route_step_get_geometry_bounding_box_n_02, NEGATIVE_TC_IDX}, + {utc_location_route_step_get_geometry_bounding_box_n_03, NEGATIVE_TC_IDX}, + {utc_location_route_step_get_distance_p, POSITIVE_TC_IDX}, + {utc_location_route_step_get_distance_n, NEGATIVE_TC_IDX}, + {utc_location_route_step_get_distance_n_02, NEGATIVE_TC_IDX}, + {utc_location_route_step_get_duration_p, POSITIVE_TC_IDX}, + {utc_location_route_step_get_duration_n, NEGATIVE_TC_IDX}, + {utc_location_route_step_get_duration_n_02, NEGATIVE_TC_IDX}, + {utc_location_route_step_get_transport_mode_p, POSITIVE_TC_IDX}, + {utc_location_route_step_get_transport_mode_n, NEGATIVE_TC_IDX}, + {utc_location_route_step_get_transport_mode_n_02, NEGATIVE_TC_IDX}, + {utc_location_route_step_get_instruction_p, POSITIVE_TC_IDX}, + {utc_location_route_step_get_instruction_n, NEGATIVE_TC_IDX}, + {utc_location_route_step_get_instruction_n_02, NEGATIVE_TC_IDX}, + {utc_location_route_step_foreach_geometries_p, POSITIVE_TC_IDX}, + {utc_location_route_step_foreach_geometries_n, NEGATIVE_TC_IDX}, + {utc_location_route_step_foreach_geometries_n_02, NEGATIVE_TC_IDX}, + {utc_location_route_step_foreach_properties_p, POSITIVE_TC_IDX}, + {utc_location_route_step_foreach_properties_n, NEGATIVE_TC_IDX}, + {utc_location_route_step_foreach_properties_n_02, NEGATIVE_TC_IDX}, + + {NULL, 0}, +}; + +static bool service_enabled = FALSE; + +static GMainLoop *g_mainloop = NULL; +static GThread *event_thread; + +gpointer GmainThread(gpointer data) +{ + g_mainloop = g_main_loop_new(NULL, 0); + g_main_loop_run(g_mainloop); + + return NULL; +} + +static void validate_and_next(char *api_name, int act_ret, int ext_ret, char *fail_msg) +{ + dts_message(api_name, "Actual Result : %d, Expected Result : %d", act_ret, ext_ret); + if (act_ret != ext_ret) { + dts_message(api_name, "Fail Message: %s", fail_msg); + dts_fail(api_name); + } +} + +static void validate_eq(char *api_name, int act_ret, int ext_ret) +{ + dts_message(api_name, "Actual Result : %d, Expected Result : %d", act_ret, ext_ret); + if (act_ret == ext_ret) { + dts_pass(api_name); + } else { + dts_fail(api_name); + } +} + +static void wait_for_service(char *api_name) +{ + int timeout = 0; + for (timeout; timeout < 180; timeout++) { + if (service_enabled) { + dts_message(api_name, "Find Routes!!!!"); + break; + } else { + dts_message(api_name, "Did not find Routes!!!!"); + sleep(1); + } + } +} + +static route_service_h g_service; +static route_h g_route; +static route_segment_h g_segment; +static route_step_h g_step; + +static bool route_segment_step_callback(route_step_h step, void *user_data) +{ + if (step == NULL) { + return FALSE; + } + + int ret = route_step_clone(&g_step, step); + validate_and_next(__func__, ret, ROUTE_ERROR_NONE, "route_step_clone() is failed"); + return TRUE; +} + +static bool route_segment_callback(route_segment_h segment, void *user_data) +{ + if (segment == NULL) { + return FALSE; + } + + int ret = route_segment_clone(&g_segment, segment); + validate_and_next(__func__, ret, ROUTE_ERROR_NONE, "route_segment_clone() is failed"); + ret = route_segment_foreach_steps(segment, route_segment_step_callback, NULL); + validate_and_next(__func__, ret, ROUTE_ERROR_NONE, "route_segment_foreach_steps() is failed"); + return TRUE; +} + +static bool route_service_found_callback(route_error_e error, int index, int total, route_h route, void *user_data) +{ + if (error != ROUTE_ERROR_NONE) { + return FALSE; + } + + service_enabled = TRUE; + + int ret = route_clone(&g_route, route); + validate_and_next(__func__, ret, ROUTE_ERROR_NONE, "route_clone() is failed"); + ret = route_foreach_segments(route, route_segment_callback, NULL); + validate_and_next(__func__, ret, ROUTE_ERROR_NONE, "route_foreach_segments() is failed"); + return TRUE; +} + +void request_route_service_start() +{ + int ret, request_id; + location_coords_s origin, destination; + + ret = route_service_create(&g_service); + validate_and_next(__func__, ret, ROUTE_ERROR_NONE, "route_service_create() is failed"); + + origin.latitude = 37.564263; + origin.longitude = 126.974676; + destination.latitude = 37.55712; + destination.longitude = 126.99241; + + ret = route_service_find(g_service, origin, destination, NULL, 0, route_service_found_callback, NULL, &request_id); + validate_and_next(__func__, ret, ROUTE_ERROR_NONE, "route_service_find() is failed"); +} + +void request_route_service_stop() +{ + if (g_service) { + route_service_destroy(g_service); + } + + if (g_route) { + route_destroy(g_route); + } + + if (g_segment) { + route_segment_destroy(g_segment); + } + + if (g_step) { + route_step_destroy(g_step); + } +} + +static void startup(void) +{ + g_setenv("PKG_NAME", "com.samsung.capi-location-route-test", 1); + g_setenv("LOCATION_TEST_ENABLE", "1", 1); + +#if !GLIB_CHECK_VERSION (2, 31, 0) + if (!g_thread_supported()) { + g_thread_init(NULL); + } +#endif + + event_thread = g_thread_create(GmainThread, NULL, 1, NULL); + + request_route_service_start(); + wait_for_service(__func__); +} + +static void cleanup(void) +{ + request_route_service_stop(); + g_main_loop_quit(g_mainloop); + g_thread_join(event_thread); +} + +static bool capi_route_foreach_property_cb(const char *key, const char *value, void *user_data) +{ + return TRUE; +} + +static bool capi_route_foreach_segment_cb(route_segment_h segment, void *user_data) +{ + return TRUE; +} + +static bool capi_segment_foreach_property_cb(const char *key, const char *value, void *user_data) +{ + return TRUE; +} + +static bool capi_segment_foreach_step_cb(route_step_h step, void *user_data) +{ + return TRUE; +} + +static bool capi_step_foreach_geometry_cb(location_coords_s * geometry, void *user_data) +{ + return TRUE; +} + +static bool capi_step_foreach_property_cb(const char *key, const char *value, void *user_datea) +{ + return TRUE; +} + +static void utc_location_route_clone_p(void) +{ + int ret = ROUTE_ERROR_NONE; + route_h cloned; + + ret = route_clone(&cloned, g_route); + validate_eq(__func__, ret, ROUTE_ERROR_NONE); +} + +static void utc_location_route_clone_n(void) +{ + int ret = ROUTE_ERROR_NONE; + + ret = route_clone(NULL, g_route); + validate_eq(__func__, ret, ROUTE_ERROR_INVALID_PARAMETER); +} + +static void utc_location_route_destroy_p(void) +{ + int ret = ROUTE_ERROR_NONE; + route_h cloned; + + ret = route_clone(&cloned, g_route); + validate_and_next(__func__, ret, ROUTE_ERROR_NONE, "route_clone() is failed"); + + ret = route_destroy(cloned); + validate_eq(__func__, ret, ROUTE_ERROR_NONE); +} + +static void utc_location_route_destroy_n(void) +{ + int ret = ROUTE_ERROR_NONE; + + ret = route_destroy(NULL); + validate_eq(__func__, ret, ROUTE_ERROR_INVALID_PARAMETER); +} + +static void utc_location_route_get_request_id_p(void) +{ + int ret = ROUTE_ERROR_NONE; + int id = 0; + + ret = route_get_request_id(g_route, &id); + validate_eq(__func__, ret, ROUTE_ERROR_NONE); +} + +static void utc_location_route_get_request_id_n(void) +{ + int ret = ROUTE_ERROR_NONE; + int id = 0; + + ret = route_get_request_id(NULL, &id); + validate_eq(__func__, ret, ROUTE_ERROR_INVALID_PARAMETER); +} + +static void utc_location_route_get_request_id_n_02(void) +{ + int ret = ROUTE_ERROR_NONE; + + ret = route_get_request_id(g_route, NULL); + validate_eq(__func__, ret, ROUTE_ERROR_INVALID_PARAMETER); +} + +static void utc_location_route_get_origin_p(void) +{ + int ret = ROUTE_ERROR_NONE; + location_coords_s origin; + + ret = route_get_origin(g_route, &origin); + if (ret == ROUTE_ERROR_RESULT_NOT_FOUND) { + validate_eq(__func__, ret, ROUTE_ERROR_RESULT_NOT_FOUND); + } else { + validate_eq(__func__, ret, ROUTE_ERROR_NONE); + } +} + +static void utc_location_route_get_origin_n(void) +{ + int ret = ROUTE_ERROR_NONE; + location_coords_s origin; + + ret = route_get_origin(NULL, &origin); + validate_eq(__func__, ret, ROUTE_ERROR_INVALID_PARAMETER); +} + +static void utc_location_route_get_origin_n_02(void) +{ + int ret = ROUTE_ERROR_NONE; + + ret = route_get_origin(g_route, NULL); + validate_eq(__func__, ret, ROUTE_ERROR_INVALID_PARAMETER); +} + +static void utc_location_route_get_destination_p(void) +{ + int ret = ROUTE_ERROR_NONE; + location_coords_s destination; + + ret = route_get_destination(g_route, &destination); + if (ret == ROUTE_ERROR_RESULT_NOT_FOUND) { + validate_eq(__func__, ret, ROUTE_ERROR_RESULT_NOT_FOUND); + } else { + validate_eq(__func__, ret, ROUTE_ERROR_NONE); + } +} + +static void utc_location_route_get_destination_n(void) +{ + int ret = ROUTE_ERROR_NONE; + location_coords_s destination; + + ret = route_get_destination(NULL, &destination); + validate_eq(__func__, ret, ROUTE_ERROR_INVALID_PARAMETER); +} + +static void utc_location_route_get_destination_n_02(void) +{ + int ret = ROUTE_ERROR_NONE; + + ret = route_get_destination(g_route, NULL); + validate_eq(__func__, ret, ROUTE_ERROR_INVALID_PARAMETER); +} + +static void utc_location_route_get_geometry_bounding_box_p(void) +{ + int ret = ROUTE_ERROR_NONE; + location_coords_s top_left; + location_coords_s bottom_right; + + ret = route_get_geometry_bounding_box(g_route, &top_left, &bottom_right); + if (ret == ROUTE_ERROR_RESULT_NOT_FOUND) { + validate_eq(__func__, ret, ROUTE_ERROR_RESULT_NOT_FOUND); + } else { + validate_eq(__func__, ret, ROUTE_ERROR_NONE); + } +} + +static void utc_location_route_get_geometry_bounding_box_n(void) +{ + int ret = ROUTE_ERROR_NONE; + location_coords_s top_left; + location_coords_s bottom_right; + + ret = route_get_geometry_bounding_box(NULL, &top_left, &bottom_right); + validate_eq(__func__, ret, ROUTE_ERROR_INVALID_PARAMETER); +} + +static void utc_location_route_get_geometry_bounding_box_n_02(void) +{ + int ret = ROUTE_ERROR_NONE; + location_coords_s bottom_right; + + ret = route_get_geometry_bounding_box(g_route, NULL, &bottom_right); + validate_eq(__func__, ret, ROUTE_ERROR_INVALID_PARAMETER); +} + +static void utc_location_route_get_geometry_bounding_box_n_03(void) +{ + int ret = ROUTE_ERROR_NONE; + location_coords_s top_left; + + ret = route_get_geometry_bounding_box(g_route, &top_left, NULL); + validate_eq(__func__, ret, ROUTE_ERROR_INVALID_PARAMETER); +} + +static void utc_location_route_get_distance_unit_p(void) +{ + int ret = ROUTE_ERROR_NONE; + route_distance_unit_e unit = ROUTE_DISTANCE_UNIT_M; + + ret = route_get_distance_unit(g_route, &unit); + validate_eq(__func__, ret, ROUTE_ERROR_NONE); +} + +static void utc_location_route_get_distance_unit_n(void) +{ + int ret = ROUTE_ERROR_NONE; + route_distance_unit_e unit = ROUTE_DISTANCE_UNIT_M; + + ret = route_get_distance_unit(NULL, &unit); + validate_eq(__func__, ret, ROUTE_ERROR_INVALID_PARAMETER); +} + +static void utc_location_route_get_distance_unit_n_02(void) +{ + int ret = ROUTE_ERROR_NONE; + + ret = route_get_distance_unit(g_route, NULL); + validate_eq(__func__, ret, ROUTE_ERROR_INVALID_PARAMETER); +} + +static void utc_location_route_get_total_distance_p(void) +{ + int ret = ROUTE_ERROR_NONE; + double distance; + + ret = route_get_total_distance(g_route, &distance); + validate_eq(__func__, ret, ROUTE_ERROR_NONE); +} + +static void utc_location_route_get_total_distance_n(void) +{ + int ret = ROUTE_ERROR_NONE; + double distance; + + ret = route_get_total_distance(NULL, &distance); + validate_eq(__func__, ret, ROUTE_ERROR_INVALID_PARAMETER); +} + +static void utc_location_route_get_total_distance_n_02(void) +{ + int ret = ROUTE_ERROR_NONE; + + ret = route_get_total_distance(g_route, NULL); + validate_eq(__func__, ret, ROUTE_ERROR_INVALID_PARAMETER); +} + +static void utc_location_route_get_total_duration_p(void) +{ + int ret = ROUTE_ERROR_NONE; + long duration; + + ret = route_get_total_duration(g_route, &duration); + validate_eq(__func__, ret, ROUTE_ERROR_NONE); +} + +static void utc_location_route_get_total_duration_n(void) +{ + int ret = ROUTE_ERROR_NONE; + long duration; + + ret = route_get_total_duration(NULL, &duration); + validate_eq(__func__, ret, ROUTE_ERROR_INVALID_PARAMETER); +} + +static void utc_location_route_get_total_duration_n_02(void) +{ + int ret = ROUTE_ERROR_NONE; + + ret = route_get_total_duration(g_route, NULL); + validate_eq(__func__, ret, ROUTE_ERROR_INVALID_PARAMETER); +} + +static void utc_location_route_foreach_properties_p(void) +{ + int ret = ROUTE_ERROR_NONE; + + ret = route_foreach_properties(g_route, capi_route_foreach_property_cb, NULL); + validate_eq(__func__, ret, ROUTE_ERROR_NONE); +} + +static void utc_location_route_foreach_properties_n(void) +{ + int ret = ROUTE_ERROR_NONE; + + ret = route_foreach_properties(NULL, capi_route_foreach_property_cb, NULL); + validate_eq(__func__, ret, ROUTE_ERROR_INVALID_PARAMETER); +} + +static void utc_location_route_foreach_properties_n_02(void) +{ + int ret = ROUTE_ERROR_NONE; + + ret = route_foreach_properties(g_route, NULL, NULL); + validate_eq(__func__, ret, ROUTE_ERROR_INVALID_PARAMETER); +} + +static void utc_location_route_foreach_segments_p(void) +{ + int ret = ROUTE_ERROR_NONE; + + ret = route_foreach_segments(g_route, capi_route_foreach_segment_cb, NULL); + validate_eq(__func__, ret, ROUTE_ERROR_NONE); +} + +static void utc_location_route_foreach_segments_n(void) +{ + int ret = ROUTE_ERROR_NONE; + + ret = route_foreach_segments(NULL, capi_route_foreach_segment_cb, NULL); + validate_eq(__func__, ret, ROUTE_ERROR_INVALID_PARAMETER); +} + +static void utc_location_route_foreach_segments_n_02(void) +{ + int ret = ROUTE_ERROR_NONE; + + ret = route_foreach_segments(g_route, NULL, NULL); + validate_eq(__func__, ret, ROUTE_ERROR_INVALID_PARAMETER); +} + +static void utc_location_route_segment_clone_p(void) +{ + int ret = ROUTE_ERROR_NONE; + route_segment_h cloned; + + ret = route_segment_clone(&cloned, g_segment); + validate_eq(__func__, ret, ROUTE_ERROR_NONE); +} + +static void utc_location_route_segment_clone_n(void) +{ + int ret = ROUTE_ERROR_NONE; + + ret = route_segment_clone(NULL, g_segment); + validate_eq(__func__, ret, ROUTE_ERROR_INVALID_PARAMETER); +} + +static void utc_location_route_segment_destroy_p(void) +{ + int ret = ROUTE_ERROR_NONE; + route_segment_h cloned; + + ret = route_segment_clone(&cloned, g_segment); + validate_and_next(__func__, ret, ROUTE_ERROR_NONE, "route_segment_clone() is failed"); + + ret = route_segment_destroy(cloned); + validate_eq(__func__, ret, ROUTE_ERROR_NONE); +} + +static void utc_location_route_segment_destroy_n(void) +{ + int ret = ROUTE_ERROR_NONE; + + ret = route_segment_destroy(NULL); + validate_eq(__func__, ret, ROUTE_ERROR_INVALID_PARAMETER); +} + +static void utc_location_route_segment_get_origin_p(void) +{ + int ret = ROUTE_ERROR_NONE; + location_coords_s origin; + + ret = route_segment_get_origin(g_segment, &origin); + if (ret == ROUTE_ERROR_RESULT_NOT_FOUND) { + validate_eq(__func__, ret, ROUTE_ERROR_RESULT_NOT_FOUND); + } else { + validate_eq(__func__, ret, ROUTE_ERROR_NONE); + } +} + +static void utc_location_route_segment_get_origin_n(void) +{ + int ret = ROUTE_ERROR_NONE; + location_coords_s origin; + + ret = route_segment_get_origin(NULL, &origin); + validate_eq(__func__, ret, ROUTE_ERROR_INVALID_PARAMETER); +} + +static void utc_location_route_segment_get_origin_n_02(void) +{ + int ret = ROUTE_ERROR_NONE; + + ret = route_segment_get_origin(g_segment, NULL); + validate_eq(__func__, ret, ROUTE_ERROR_INVALID_PARAMETER); +} + +static void utc_location_route_segment_get_destination_p(void) +{ + int ret = ROUTE_ERROR_NONE; + location_coords_s destination; + + ret = route_segment_get_destination(g_segment, &destination); + if (ret == ROUTE_ERROR_RESULT_NOT_FOUND) { + validate_eq(__func__, ret, ROUTE_ERROR_RESULT_NOT_FOUND); + } else { + validate_eq(__func__, ret, ROUTE_ERROR_NONE); + } +} + +static void utc_location_route_segment_get_destination_n(void) +{ + int ret = ROUTE_ERROR_NONE; + location_coords_s destination; + + ret = route_segment_get_destination(NULL, &destination); + validate_eq(__func__, ret, ROUTE_ERROR_INVALID_PARAMETER); +} + +static void utc_location_route_segment_get_destination_n_02(void) +{ + int ret = ROUTE_ERROR_NONE; + + ret = route_segment_get_destination(g_segment, NULL); + validate_eq(__func__, ret, ROUTE_ERROR_INVALID_PARAMETER); +} + +static void utc_location_route_segment_get_geometry_bounding_box_p(void) +{ + int ret = ROUTE_ERROR_NONE; + location_coords_s top_left; + location_coords_s bottom_right; + + ret = route_segment_get_geometry_bounding_box(g_segment, &top_left, &bottom_right); + if (ret == ROUTE_ERROR_RESULT_NOT_FOUND) { + validate_eq(__func__, ret, ROUTE_ERROR_RESULT_NOT_FOUND); + } else { + validate_eq(__func__, ret, ROUTE_ERROR_NONE); + } +} + +static void utc_location_route_segment_get_geometry_bounding_box_n(void) +{ + int ret = ROUTE_ERROR_NONE; + location_coords_s top_left; + location_coords_s bottom_right; + + ret = route_segment_get_geometry_bounding_box(NULL, &top_left, &bottom_right); + validate_eq(__func__, ret, ROUTE_ERROR_INVALID_PARAMETER); +} + +static void utc_location_route_segment_get_geometry_bounding_box_n_02(void) +{ + int ret = ROUTE_ERROR_NONE; + location_coords_s top_left; + + ret = route_segment_get_geometry_bounding_box(g_segment, &top_left, NULL); + validate_eq(__func__, ret, ROUTE_ERROR_INVALID_PARAMETER); +} + +static void utc_location_route_segment_get_geometry_bounding_box_n_03(void) +{ + int ret = ROUTE_ERROR_NONE; + location_coords_s bottom_right; + + ret = route_segment_get_geometry_bounding_box(g_segment, NULL, &bottom_right); + validate_eq(__func__, ret, ROUTE_ERROR_INVALID_PARAMETER); +} + +static void utc_location_route_segment_get_distance_p(void) +{ + int ret = ROUTE_ERROR_NONE; + double distance; + + ret = route_segment_get_distance(g_segment, &distance); + validate_eq(__func__, ret, ROUTE_ERROR_NONE); +} + +static void utc_location_route_segment_get_distance_n(void) +{ + int ret = ROUTE_ERROR_NONE; + double distance; + + ret = route_segment_get_distance(NULL, &distance); + validate_eq(__func__, ret, ROUTE_ERROR_INVALID_PARAMETER); +} + +static void utc_location_route_segment_get_distance_n_02(void) +{ + int ret = ROUTE_ERROR_NONE; + + ret = route_segment_get_distance(g_segment, NULL); + validate_eq(__func__, ret, ROUTE_ERROR_INVALID_PARAMETER); +} + +static void utc_location_route_segment_get_duration_p(void) +{ + int ret = ROUTE_ERROR_NONE; + long duration; + + ret = route_segment_get_duration(g_segment, &duration); + validate_eq(__func__, ret, ROUTE_ERROR_NONE); +} + +static void utc_location_route_segment_get_duration_n(void) +{ + int ret = ROUTE_ERROR_NONE; + long duration; + + ret = route_segment_get_duration(NULL, &duration); + validate_eq(__func__, ret, ROUTE_ERROR_INVALID_PARAMETER); +} + +static void utc_location_route_segment_get_duration_n_02(void) +{ + int ret = ROUTE_ERROR_NONE; + + ret = route_segment_get_duration(g_segment, NULL); + validate_eq(__func__, ret, ROUTE_ERROR_INVALID_PARAMETER); +} + +static void utc_location_route_segment_foreach_properties_p(void) +{ + int ret = ROUTE_ERROR_NONE; + + ret = route_segment_foreach_properties(g_segment, capi_segment_foreach_property_cb, NULL); + validate_eq(__func__, ret, ROUTE_ERROR_NONE); +} + +static void utc_location_route_segment_foreach_properties_n(void) +{ + int ret = ROUTE_ERROR_NONE; + + ret = route_segment_foreach_properties(NULL, capi_segment_foreach_property_cb, NULL); + validate_eq(__func__, ret, ROUTE_ERROR_INVALID_PARAMETER); +} + +static void utc_location_route_segment_foreach_properties_n_02(void) +{ + int ret = ROUTE_ERROR_NONE; + + ret = route_segment_foreach_properties(g_segment, NULL, NULL); + validate_eq(__func__, ret, ROUTE_ERROR_INVALID_PARAMETER); +} + +static void utc_location_route_segment_foreach_steps_p(void) +{ + int ret = ROUTE_ERROR_NONE; + + ret = route_segment_foreach_steps(g_segment, capi_segment_foreach_step_cb, NULL); + validate_eq(__func__, ret, ROUTE_ERROR_NONE); +} + +static void utc_location_route_segment_foreach_steps_n(void) +{ + int ret = ROUTE_ERROR_NONE; + + ret = route_segment_foreach_steps(NULL, capi_segment_foreach_step_cb, NULL); + validate_eq(__func__, ret, ROUTE_ERROR_INVALID_PARAMETER); +} + +static void utc_location_route_segment_foreach_steps_n_02(void) +{ + int ret = ROUTE_ERROR_NONE; + + ret = route_segment_foreach_steps(g_segment, NULL, NULL); + validate_eq(__func__, ret, ROUTE_ERROR_INVALID_PARAMETER); +} + +static void utc_location_route_step_clone_p(void) +{ + int ret = ROUTE_ERROR_NONE; + route_step_h cloned; + + ret = route_step_clone(&cloned, g_step); + validate_eq(__func__, ret, ROUTE_ERROR_NONE); +} + +static void utc_location_route_step_clone_n(void) +{ + int ret = ROUTE_ERROR_NONE; + + ret = route_step_clone(NULL, g_step); + validate_eq(__func__, ret, ROUTE_ERROR_INVALID_PARAMETER); +} + +static void utc_location_route_step_destroy_p(void) +{ + int ret = ROUTE_ERROR_NONE; + route_step_h cloned; + + ret = route_step_clone(&cloned, g_step); + validate_and_next(__func__, ret, ROUTE_ERROR_NONE, "route_step_clone() is failed"); + + ret = route_step_destroy(cloned); + validate_eq(__func__, ret, ROUTE_ERROR_NONE); +} + +static void utc_location_route_step_destroy_n(void) +{ + int ret = ROUTE_ERROR_NONE; + + ret = route_step_destroy(NULL); + validate_eq(__func__, ret, ROUTE_ERROR_INVALID_PARAMETER); +} + +static void utc_location_route_step_get_origin_p(void) +{ + int ret = ROUTE_ERROR_NONE; + location_coords_s origin; + + ret = route_step_get_origin(g_step, &origin); + if (ret == ROUTE_ERROR_RESULT_NOT_FOUND) { + validate_eq(__func__, ret, ROUTE_ERROR_RESULT_NOT_FOUND); + } else { + validate_eq(__func__, ret, ROUTE_ERROR_NONE); + } +} + +static void utc_location_route_step_get_origin_n(void) +{ + int ret = ROUTE_ERROR_NONE; + location_coords_s origin; + + ret = route_step_get_origin(NULL, &origin); + validate_eq(__func__, ret, ROUTE_ERROR_INVALID_PARAMETER); +} + +static void utc_location_route_step_get_origin_n_02(void) +{ + int ret = ROUTE_ERROR_NONE; + + ret = route_step_get_origin(g_step, NULL); + validate_eq(__func__, ret, ROUTE_ERROR_INVALID_PARAMETER); +} + +static void utc_location_route_step_get_destination_p(void) +{ + int ret = ROUTE_ERROR_NONE; + location_coords_s destination; + + ret = route_step_get_destination(g_step, &destination); + if (ret == ROUTE_ERROR_RESULT_NOT_FOUND) { + validate_eq(__func__, ret, ROUTE_ERROR_RESULT_NOT_FOUND); + } else { + validate_eq(__func__, ret, ROUTE_ERROR_NONE); + } +} + +static void utc_location_route_step_get_destination_n(void) +{ + int ret = ROUTE_ERROR_NONE; + location_coords_s destination; + + ret = route_step_get_destination(NULL, &destination); + validate_eq(__func__, ret, ROUTE_ERROR_INVALID_PARAMETER); +} + +static void utc_location_route_step_get_destination_n_02(void) +{ + int ret = ROUTE_ERROR_NONE; + + ret = route_step_get_destination(g_step, NULL); + validate_eq(__func__, ret, ROUTE_ERROR_INVALID_PARAMETER); +} + +static void utc_location_route_step_get_geometry_bounding_box_p(void) +{ + int ret = ROUTE_ERROR_NONE; + location_coords_s top_left; + location_coords_s bottom_right; + + ret = route_step_get_geometry_bounding_box(g_step, &top_left, &bottom_right); + if (ret == ROUTE_ERROR_RESULT_NOT_FOUND) { + validate_eq(__func__, ret, ROUTE_ERROR_RESULT_NOT_FOUND); + } else { + validate_eq(__func__, ret, ROUTE_ERROR_NONE); + } +} + +static void utc_location_route_step_get_geometry_bounding_box_n(void) +{ + int ret = ROUTE_ERROR_NONE; + location_coords_s top_left; + location_coords_s bottom_right; + + ret = route_step_get_geometry_bounding_box(NULL, &top_left, &bottom_right); + validate_eq(__func__, ret, ROUTE_ERROR_INVALID_PARAMETER); +} + +static void utc_location_route_step_get_geometry_bounding_box_n_02(void) +{ + int ret = ROUTE_ERROR_NONE; + location_coords_s top_left; + + ret = route_step_get_geometry_bounding_box(g_step, &top_left, NULL); + validate_eq(__func__, ret, ROUTE_ERROR_INVALID_PARAMETER); +} + +static void utc_location_route_step_get_geometry_bounding_box_n_03(void) +{ + int ret = ROUTE_ERROR_NONE; + location_coords_s bottom_right; + + ret = route_step_get_geometry_bounding_box(g_step, NULL, &bottom_right); + validate_eq(__func__, ret, ROUTE_ERROR_INVALID_PARAMETER); +} + +static void utc_location_route_step_get_distance_p(void) +{ + int ret = ROUTE_ERROR_NONE; + double distance; + + ret = route_step_get_distance(g_step, &distance); + validate_eq(__func__, ret, ROUTE_ERROR_NONE); +} + +static void utc_location_route_step_get_distance_n(void) +{ + int ret = ROUTE_ERROR_NONE; + double distance; + + ret = route_step_get_distance(NULL, &distance); + validate_eq(__func__, ret, ROUTE_ERROR_INVALID_PARAMETER); +} + +static void utc_location_route_step_get_distance_n_02(void) +{ + int ret = ROUTE_ERROR_NONE; + + ret = route_step_get_distance(g_step, NULL); + validate_eq(__func__, ret, ROUTE_ERROR_INVALID_PARAMETER); +} + +static void utc_location_route_step_get_duration_p(void) +{ + int ret = ROUTE_ERROR_NONE; + long duration; + + ret = route_step_get_duration(g_step, &duration); + validate_eq(__func__, ret, ROUTE_ERROR_NONE); +} + +static void utc_location_route_step_get_duration_n(void) +{ + int ret = ROUTE_ERROR_NONE; + long duration; + + ret = route_step_get_duration(NULL, &duration); + validate_eq(__func__, ret, ROUTE_ERROR_INVALID_PARAMETER); +} + +static void utc_location_route_step_get_duration_n_02(void) +{ + int ret = ROUTE_ERROR_NONE; + + ret = route_step_get_duration(g_step, NULL); + validate_eq(__func__, ret, ROUTE_ERROR_INVALID_PARAMETER); +} + +static void utc_location_route_step_get_transport_mode_p(void) +{ + int ret = ROUTE_ERROR_NONE; + char *mode = NULL; + + ret = route_step_get_transport_mode(g_step, &mode); + if (mode != NULL) { + free(mode); + } + + if (ret == ROUTE_ERROR_RESULT_NOT_FOUND) { + validate_eq(__func__, ret, ROUTE_ERROR_RESULT_NOT_FOUND); + } else { + validate_eq(__func__, ret, ROUTE_ERROR_NONE); + } +} + +static void utc_location_route_step_get_transport_mode_n(void) +{ + int ret = ROUTE_ERROR_NONE; + char *mode = NULL; + + ret = route_step_get_transport_mode(NULL, &mode); + validate_eq(__func__, ret, ROUTE_ERROR_INVALID_PARAMETER); +} + +static void utc_location_route_step_get_transport_mode_n_02(void) +{ + int ret = ROUTE_ERROR_NONE; + + ret = route_step_get_transport_mode(g_step, NULL); + validate_eq(__func__, ret, ROUTE_ERROR_INVALID_PARAMETER); +} + +static void utc_location_route_step_get_instruction_p(void) +{ + int ret = ROUTE_ERROR_NONE; + char *instruction = NULL; + + ret = route_step_get_instruction(g_step, &instruction); + if (instruction != NULL) { + free(instruction); + } + + if (ret == ROUTE_ERROR_RESULT_NOT_FOUND) { + validate_eq(__func__, ret, ROUTE_ERROR_RESULT_NOT_FOUND); + } else { + validate_eq(__func__, ret, ROUTE_ERROR_NONE); + } +} + +static void utc_location_route_step_get_instruction_n(void) +{ + int ret = ROUTE_ERROR_NONE; + char *instruction = NULL; + + ret = route_step_get_instruction(NULL, &instruction); + validate_eq(__func__, ret, ROUTE_ERROR_INVALID_PARAMETER); +} + +static void utc_location_route_step_get_instruction_n_02(void) +{ + int ret = ROUTE_ERROR_NONE; + + ret = route_step_get_instruction(g_step, NULL); + validate_eq(__func__, ret, ROUTE_ERROR_INVALID_PARAMETER); +} + +static void utc_location_route_step_foreach_geometries_p(void) +{ + int ret = ROUTE_ERROR_NONE; + + ret = route_step_foreach_geometries(g_step, capi_step_foreach_geometry_cb, NULL); + validate_eq(__func__, ret, ROUTE_ERROR_NONE); +} + +static void utc_location_route_step_foreach_geometries_n(void) +{ + int ret = ROUTE_ERROR_NONE; + + ret = route_step_foreach_geometries(NULL, capi_step_foreach_geometry_cb, NULL); + validate_eq(__func__, ret, ROUTE_ERROR_INVALID_PARAMETER); +} + +static void utc_location_route_step_foreach_geometries_n_02(void) +{ + int ret = ROUTE_ERROR_NONE; + + ret = route_step_foreach_geometries(g_step, NULL, NULL); + validate_eq(__func__, ret, ROUTE_ERROR_INVALID_PARAMETER); +} + +static void utc_location_route_step_foreach_properties_p(void) +{ + int ret = ROUTE_ERROR_NONE; + + ret = route_step_foreach_properties(g_step, capi_step_foreach_property_cb, NULL); + validate_eq(__func__, ret, ROUTE_ERROR_NONE); +} + +static void utc_location_route_step_foreach_properties_n(void) +{ + int ret = ROUTE_ERROR_NONE; + + ret = route_step_foreach_properties(NULL, capi_step_foreach_property_cb, NULL); + validate_eq(__func__, ret, ROUTE_ERROR_INVALID_PARAMETER); +} + +static void utc_location_route_step_foreach_properties_n_02(void) +{ + int ret = ROUTE_ERROR_NONE; + + ret = route_step_foreach_properties(g_step, NULL, NULL); + validate_eq(__func__, ret, ROUTE_ERROR_INVALID_PARAMETER); +} diff --git a/TC/testcase/utc_location_route_preference.c b/TC/testcase/utc_location_route_preference.c new file mode 100644 index 0000000..ca9ec1d --- /dev/null +++ b/TC/testcase/utc_location_route_preference.c @@ -0,0 +1,1500 @@ +/* +* Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* + * This testcase is only for decarta. + */ +#include + +#include +#include +#include + +enum { + POSITIVE_TC_IDX = 0x01, + NEGATIVE_TC_IDX, +}; + +static void startup(void); +static void cleanup(void); + +void (*tet_startup) (void) = startup; +void (*tet_cleanup) (void) = cleanup; + +static void utc_location_route_preference_create_p(void); +static void utc_location_route_preference_create_n(void); +static void utc_location_route_preference_foreach_addresses_to_avoid_p(void); +static void utc_location_route_preference_foreach_addresses_to_avoid_n(void); +static void utc_location_route_preference_foreach_addresses_to_avoid_n_02(void); +static void utc_location_route_preference_foreach_areas_to_avoid_p(void); +static void utc_location_route_preference_foreach_areas_to_avoid_n(void); +static void utc_location_route_preference_foreach_areas_to_avoid_n_02(void); +static void utc_location_route_preference_foreach_constraints_p(void); +static void utc_location_route_preference_foreach_constraints_n(void); +static void utc_location_route_preference_foreach_constraints_n_02(void); +static void utc_location_route_preference_foreach_properties_p(void); +static void utc_location_route_preference_foreach_properties_n(void); +static void utc_location_route_preference_foreach_properties_n_02(void); +static void utc_location_route_preference_get_geometry_bounding_box_p(void); +static void utc_location_route_preference_get_geometry_bounding_box_n(void); +static void utc_location_route_preference_get_geometry_bounding_box_n_02(void); +static void utc_location_route_preference_get_geometry_bounding_box_n_03(void); +static void utc_location_route_preference_get_max_results_p(void); +static void utc_location_route_preference_get_max_results_n(void); +static void utc_location_route_preference_get_max_results_n_02(void); +static void utc_location_route_preference_get_goal_p(void); +static void utc_location_route_preference_get_goal_n(void); +static void utc_location_route_preference_get_goal_n_02(void); +static void utc_location_route_preference_get_transport_mode_p(void); +static void utc_location_route_preference_get_transport_mode_n(void); +static void utc_location_route_preference_get_transport_mode_n_02(void); +static void utc_location_route_preference_is_geometry_used_p(void); +static void utc_location_route_preference_is_geometry_used_n(void); +static void utc_location_route_preference_is_instruction_bounding_box_used_p(void); +static void utc_location_route_preference_is_instruction_bounding_box_used_n(void); +static void utc_location_route_preference_is_instruction_geometry_used_p(void); +static void utc_location_route_preference_is_instruction_geometry_used_n(void); +static void utc_location_route_preference_is_instruction_used_p(void); +static void utc_location_route_preference_is_instruction_used_n(void); +static void utc_location_route_preference_is_traffic_data_used_p(void); +static void utc_location_route_preference_is_traffic_data_used_n(void); +static void utc_location_route_preference_get_p(void); +static void utc_location_route_preference_get_n(void); +static void utc_location_route_preference_get_n_02(void); +static void utc_location_route_preference_get_n_03(void); +static void utc_location_route_preference_set_p(void); +static void utc_location_route_preference_set_n(void); +static void utc_location_route_preference_set_n_02(void); +static void utc_location_route_preference_set_n_03(void); +static void utc_location_route_preference_add_address_to_avoid_p(void); +static void utc_location_route_preference_add_address_to_avoid_n(void); +static void utc_location_route_preference_add_address_to_avoid_n_02(void); +static void utc_location_route_preference_clear_addresses_to_avoid_p(void); +static void utc_location_route_preference_clear_addresses_to_avoid_n(void); +static void utc_location_route_preference_add_area_to_avoid_p(void); +static void utc_location_route_preference_add_area_to_avoid_n(void); +static void utc_location_route_preference_add_area_to_avoid_n_02(void); +static void utc_location_route_preference_clear_areas_to_avoid_p(void); +static void utc_location_route_preference_clear_areas_to_avoid_n(void); +static void utc_location_route_preference_add_constraint_p(void); +static void utc_location_route_preference_add_constraint_n(void); +static void utc_location_route_preference_add_constraint_n_02(void); +static void utc_location_route_preference_clear_constraints_p(void); +static void utc_location_route_preference_clear_constraints_n(void); +static void utc_location_route_preference_set_geometry_bounding_box_p(void); +static void utc_location_route_preference_set_geometry_bounding_box_n(void); +static void utc_location_route_preference_set_max_results_p(void); +static void utc_location_route_preference_set_max_results_n(void); +static void utc_location_route_preference_set_goal_p(void); +static void utc_location_route_preference_set_goal_n(void); +static void utc_location_route_preference_set_goal_n_02(void); +static void utc_location_route_preference_set_transport_mode_p(void); +static void utc_location_route_preference_set_transport_mode_n(void); +static void utc_location_route_preference_set_transport_mode_n_02(void); +static void utc_location_route_preference_set_geometry_used_p(void); +static void utc_location_route_preference_set_geometry_used_p_02(void); +static void utc_location_route_preference_set_geometry_used_n(void); +static void utc_location_route_preference_set_instruction_bounding_box_used_p(void); +static void utc_location_route_preference_set_instruction_bounding_box_used_p_02(void); +static void utc_location_route_preference_set_instruction_bounding_box_used_n(void); +static void utc_location_route_preference_set_instruction_geometry_used_p(void); +static void utc_location_route_preference_set_instruction_geometry_used_p_02(void); +static void utc_location_route_preference_set_instruction_geometry_used_n(void); +static void utc_location_route_preference_set_instruction_used_p(void); +static void utc_location_route_preference_set_instruction_used_p_02(void); +static void utc_location_route_preference_set_instruction_used_n(void); +static void utc_location_route_preference_set_traffic_data_used_p(void); +static void utc_location_route_preference_set_traffic_data_used_p_02(void); +static void utc_location_route_preference_set_traffic_data_used_n(void); +static void utc_location_route_preference_is_area_to_avoid_supported_p(void); +static void utc_location_route_preference_is_area_to_avoid_supported_p_02(void); +static void utc_location_route_preference_is_area_to_avoid_supported_p_03(void); +static void utc_location_route_preference_is_area_to_avoid_supported_n(void); +static void utc_location_route_preference_is_address_to_avoid_supported_p(void); +static void utc_location_route_preference_is_address_to_avoid_supported_n(void); +static void utc_location_route_preference_is_geometry_bounding_box_supported_p(void); +static void utc_location_route_preference_is_geometry_bounding_box_supported_n(void); +static void utc_location_route_preference_is_geometry_supported_p(void); +static void utc_location_route_preference_is_geometry_supported_n(void); +static void utc_location_route_preference_is_instruction_geometry_supported_p(void); +static void utc_location_route_preference_is_instruction_geometry_supported_n(void); +static void utc_location_route_preference_is_instruction_bounding_box_supported_p(void); +static void utc_location_route_preference_is_instruction_bounding_box_supported_n(void); +static void utc_location_route_preference_is_instruction_supported_p(void); +static void utc_location_route_preference_is_instruction_supported_n(void); +static void utc_location_route_preference_is_traffic_data_supported_p(void); +static void utc_location_route_preference_is_traffic_data_supported_n(void); +static void utc_location_route_preference_foreach_available_constraints_p(void); +static void utc_location_route_preference_foreach_available_constraints_n(void); +static void utc_location_route_preference_foreach_available_constraints_n_02(void); +static void utc_location_route_preference_foreach_available_goals_p(void); +static void utc_location_route_preference_foreach_available_goals_n(void); +static void utc_location_route_preference_foreach_available_goals_n_02(void); +static void utc_location_route_preference_foreach_available_transport_modes_p(void); +static void utc_location_route_preference_foreach_available_transport_modes_n(void); +static void utc_location_route_preference_foreach_available_transport_modes_n_02(void); +static void utc_location_route_preference_foreach_available_property_keys_p(void); +static void utc_location_route_preference_foreach_available_property_keys_n(void); +static void utc_location_route_preference_foreach_available_property_keys_n_02(void); +static void utc_location_route_preference_foreach_available_property_values_p(void); +static void utc_location_route_preference_foreach_available_property_values_n(void); +static void utc_location_route_preference_foreach_available_property_values_n_02(void); +static void utc_location_route_preference_foreach_available_property_values_n_03(void); +static void utc_location_route_preference_destroy_p(void); +static void utc_location_route_preference_destroy_n(void); + +struct tet_testlist tet_testlist[] = { + {utc_location_route_preference_create_p, POSITIVE_TC_IDX}, + {utc_location_route_preference_create_n, NEGATIVE_TC_IDX}, + {utc_location_route_preference_foreach_addresses_to_avoid_p, POSITIVE_TC_IDX}, + {utc_location_route_preference_foreach_addresses_to_avoid_n, NEGATIVE_TC_IDX}, + {utc_location_route_preference_foreach_addresses_to_avoid_n_02, NEGATIVE_TC_IDX}, + {utc_location_route_preference_foreach_areas_to_avoid_p, POSITIVE_TC_IDX}, + {utc_location_route_preference_foreach_areas_to_avoid_n, NEGATIVE_TC_IDX}, + {utc_location_route_preference_foreach_areas_to_avoid_n_02, NEGATIVE_TC_IDX}, + {utc_location_route_preference_foreach_constraints_p, POSITIVE_TC_IDX}, + {utc_location_route_preference_foreach_constraints_n, NEGATIVE_TC_IDX}, + {utc_location_route_preference_foreach_constraints_n_02, NEGATIVE_TC_IDX}, + {utc_location_route_preference_foreach_properties_p, POSITIVE_TC_IDX}, + {utc_location_route_preference_foreach_properties_n, NEGATIVE_TC_IDX}, + {utc_location_route_preference_foreach_properties_n_02, NEGATIVE_TC_IDX}, + {utc_location_route_preference_get_geometry_bounding_box_p, POSITIVE_TC_IDX}, + {utc_location_route_preference_get_geometry_bounding_box_n, NEGATIVE_TC_IDX}, + {utc_location_route_preference_get_geometry_bounding_box_n_02, NEGATIVE_TC_IDX}, + {utc_location_route_preference_get_geometry_bounding_box_n_03, NEGATIVE_TC_IDX}, + {utc_location_route_preference_get_max_results_p, POSITIVE_TC_IDX}, + {utc_location_route_preference_get_max_results_n, NEGATIVE_TC_IDX}, + {utc_location_route_preference_get_max_results_n_02, NEGATIVE_TC_IDX}, + {utc_location_route_preference_get_goal_p, POSITIVE_TC_IDX}, + {utc_location_route_preference_get_goal_n, NEGATIVE_TC_IDX}, + {utc_location_route_preference_get_goal_n_02, NEGATIVE_TC_IDX}, + {utc_location_route_preference_get_transport_mode_p, POSITIVE_TC_IDX}, + {utc_location_route_preference_get_transport_mode_n, NEGATIVE_TC_IDX}, + {utc_location_route_preference_get_transport_mode_n_02, NEGATIVE_TC_IDX}, + {utc_location_route_preference_is_geometry_used_p, POSITIVE_TC_IDX}, + {utc_location_route_preference_is_geometry_used_n, NEGATIVE_TC_IDX}, + {utc_location_route_preference_is_instruction_bounding_box_used_p, POSITIVE_TC_IDX}, + {utc_location_route_preference_is_instruction_bounding_box_used_n, NEGATIVE_TC_IDX}, + {utc_location_route_preference_is_instruction_geometry_used_p, POSITIVE_TC_IDX}, + {utc_location_route_preference_is_instruction_geometry_used_n, NEGATIVE_TC_IDX}, + {utc_location_route_preference_is_instruction_used_p, POSITIVE_TC_IDX}, + {utc_location_route_preference_is_instruction_used_n, NEGATIVE_TC_IDX}, + {utc_location_route_preference_is_traffic_data_used_p, POSITIVE_TC_IDX}, + {utc_location_route_preference_is_traffic_data_used_n, NEGATIVE_TC_IDX}, + {utc_location_route_preference_get_p, POSITIVE_TC_IDX}, + {utc_location_route_preference_get_n, NEGATIVE_TC_IDX}, + {utc_location_route_preference_get_n_02, NEGATIVE_TC_IDX}, + {utc_location_route_preference_get_n_03, NEGATIVE_TC_IDX}, + {utc_location_route_preference_set_p, POSITIVE_TC_IDX}, + {utc_location_route_preference_set_n, NEGATIVE_TC_IDX}, + {utc_location_route_preference_set_n_02, NEGATIVE_TC_IDX}, + {utc_location_route_preference_set_n_03, NEGATIVE_TC_IDX}, + {utc_location_route_preference_add_address_to_avoid_p, POSITIVE_TC_IDX}, + {utc_location_route_preference_add_address_to_avoid_n, NEGATIVE_TC_IDX}, + {utc_location_route_preference_add_address_to_avoid_n_02, NEGATIVE_TC_IDX}, + {utc_location_route_preference_clear_addresses_to_avoid_p, POSITIVE_TC_IDX}, + {utc_location_route_preference_clear_addresses_to_avoid_n, NEGATIVE_TC_IDX}, + {utc_location_route_preference_add_area_to_avoid_p, POSITIVE_TC_IDX}, + {utc_location_route_preference_add_area_to_avoid_n, NEGATIVE_TC_IDX}, + {utc_location_route_preference_add_area_to_avoid_n_02, NEGATIVE_TC_IDX}, + {utc_location_route_preference_clear_areas_to_avoid_p, POSITIVE_TC_IDX}, + {utc_location_route_preference_clear_areas_to_avoid_n, NEGATIVE_TC_IDX}, + {utc_location_route_preference_add_constraint_p, POSITIVE_TC_IDX}, + {utc_location_route_preference_add_constraint_n, NEGATIVE_TC_IDX}, + {utc_location_route_preference_add_constraint_n_02, NEGATIVE_TC_IDX}, + {utc_location_route_preference_clear_constraints_p, POSITIVE_TC_IDX}, + {utc_location_route_preference_clear_constraints_n, NEGATIVE_TC_IDX}, + {utc_location_route_preference_set_geometry_bounding_box_p, POSITIVE_TC_IDX}, + {utc_location_route_preference_set_geometry_bounding_box_n, NEGATIVE_TC_IDX}, + {utc_location_route_preference_set_max_results_p, POSITIVE_TC_IDX}, + {utc_location_route_preference_set_max_results_n, NEGATIVE_TC_IDX}, + {utc_location_route_preference_set_goal_p, POSITIVE_TC_IDX}, + {utc_location_route_preference_set_goal_n, NEGATIVE_TC_IDX}, + {utc_location_route_preference_set_goal_n_02, NEGATIVE_TC_IDX}, + {utc_location_route_preference_set_transport_mode_p, POSITIVE_TC_IDX}, + {utc_location_route_preference_set_transport_mode_n, NEGATIVE_TC_IDX}, + {utc_location_route_preference_set_transport_mode_n_02, NEGATIVE_TC_IDX}, + {utc_location_route_preference_set_geometry_used_p, POSITIVE_TC_IDX}, + {utc_location_route_preference_set_geometry_used_p_02, POSITIVE_TC_IDX}, + {utc_location_route_preference_set_geometry_used_n, NEGATIVE_TC_IDX}, + {utc_location_route_preference_set_instruction_bounding_box_used_p, POSITIVE_TC_IDX}, + {utc_location_route_preference_set_instruction_bounding_box_used_p_02, POSITIVE_TC_IDX}, + {utc_location_route_preference_set_instruction_bounding_box_used_n, NEGATIVE_TC_IDX}, + {utc_location_route_preference_set_instruction_geometry_used_p, POSITIVE_TC_IDX}, + {utc_location_route_preference_set_instruction_geometry_used_p_02, POSITIVE_TC_IDX}, + {utc_location_route_preference_set_instruction_geometry_used_n, NEGATIVE_TC_IDX}, + {utc_location_route_preference_set_instruction_used_p, POSITIVE_TC_IDX}, + {utc_location_route_preference_set_instruction_used_p_02, POSITIVE_TC_IDX}, + {utc_location_route_preference_set_instruction_used_n, NEGATIVE_TC_IDX}, + {utc_location_route_preference_set_traffic_data_used_p, POSITIVE_TC_IDX}, + {utc_location_route_preference_set_traffic_data_used_p_02, POSITIVE_TC_IDX}, + {utc_location_route_preference_set_traffic_data_used_n, NEGATIVE_TC_IDX}, + {utc_location_route_preference_is_area_to_avoid_supported_p, POSITIVE_TC_IDX}, + {utc_location_route_preference_is_area_to_avoid_supported_p_02, POSITIVE_TC_IDX}, + {utc_location_route_preference_is_area_to_avoid_supported_p_03, POSITIVE_TC_IDX}, + {utc_location_route_preference_is_area_to_avoid_supported_n, NEGATIVE_TC_IDX}, + {utc_location_route_preference_is_address_to_avoid_supported_p, POSITIVE_TC_IDX}, + {utc_location_route_preference_is_address_to_avoid_supported_n, NEGATIVE_TC_IDX}, + {utc_location_route_preference_is_geometry_bounding_box_supported_p, POSITIVE_TC_IDX}, + {utc_location_route_preference_is_geometry_bounding_box_supported_n, NEGATIVE_TC_IDX}, + {utc_location_route_preference_is_geometry_supported_p, POSITIVE_TC_IDX}, + {utc_location_route_preference_is_geometry_supported_n, NEGATIVE_TC_IDX}, + {utc_location_route_preference_is_instruction_geometry_supported_p, POSITIVE_TC_IDX}, + {utc_location_route_preference_is_instruction_geometry_supported_n, NEGATIVE_TC_IDX}, + {utc_location_route_preference_is_instruction_bounding_box_supported_p, POSITIVE_TC_IDX}, + {utc_location_route_preference_is_instruction_bounding_box_supported_n, NEGATIVE_TC_IDX}, + {utc_location_route_preference_is_instruction_supported_p, POSITIVE_TC_IDX}, + {utc_location_route_preference_is_instruction_supported_n, NEGATIVE_TC_IDX}, + {utc_location_route_preference_is_traffic_data_supported_p, POSITIVE_TC_IDX}, + {utc_location_route_preference_is_traffic_data_supported_n, NEGATIVE_TC_IDX}, + {utc_location_route_preference_foreach_available_constraints_p, POSITIVE_TC_IDX}, + {utc_location_route_preference_foreach_available_constraints_n, NEGATIVE_TC_IDX}, + {utc_location_route_preference_foreach_available_constraints_n_02, NEGATIVE_TC_IDX}, + {utc_location_route_preference_foreach_available_goals_p, POSITIVE_TC_IDX}, + {utc_location_route_preference_foreach_available_goals_n, NEGATIVE_TC_IDX}, + {utc_location_route_preference_foreach_available_goals_n_02, NEGATIVE_TC_IDX}, + {utc_location_route_preference_foreach_available_transport_modes_p, POSITIVE_TC_IDX}, + {utc_location_route_preference_foreach_available_transport_modes_n, NEGATIVE_TC_IDX}, + {utc_location_route_preference_foreach_available_transport_modes_n_02, NEGATIVE_TC_IDX}, + {utc_location_route_preference_foreach_available_property_keys_p, POSITIVE_TC_IDX}, + {utc_location_route_preference_foreach_available_property_keys_n, NEGATIVE_TC_IDX}, + {utc_location_route_preference_foreach_available_property_keys_n_02, NEGATIVE_TC_IDX}, + {utc_location_route_preference_foreach_available_property_values_p, POSITIVE_TC_IDX}, + {utc_location_route_preference_foreach_available_property_values_n, NEGATIVE_TC_IDX}, + {utc_location_route_preference_foreach_available_property_values_n_02, NEGATIVE_TC_IDX}, + {utc_location_route_preference_foreach_available_property_values_n_03, NEGATIVE_TC_IDX}, + {utc_location_route_preference_destroy_p, POSITIVE_TC_IDX}, + {utc_location_route_preference_destroy_n, NEGATIVE_TC_IDX}, + + {NULL, 0}, +}; + +static bool service_enabled = FALSE; + +static GMainLoop *g_mainloop = NULL; +static GThread *event_thread; + +gpointer GmainThread(gpointer data) +{ + g_mainloop = g_main_loop_new(NULL, 0); + g_main_loop_run(g_mainloop); + + return NULL; +} + +static void validate_and_next(char *api_name, int act_ret, int ext_ret, char *fail_msg) +{ + dts_message(api_name, "Actual Result : %d, Expected Result : %d", act_ret, ext_ret); + if (act_ret != ext_ret) { + dts_message(api_name, "Fail Message: %s", fail_msg); + dts_fail(api_name); + } +} + +static void validate_eq(char *api_name, int act_ret, int ext_ret) +{ + dts_message(api_name, "Actual Result : %d, Expected Result : %d", act_ret, ext_ret); + if (act_ret == ext_ret) { + dts_pass(api_name); + } else { + dts_fail(api_name); + } +} + +static void validate_eq_bool(char *api_name, bool act_ret, bool ext_ret) +{ + dts_message(api_name, "Actual Result : %d, Expected Result : %d", act_ret, ext_ret); + if (act_ret == ext_ret) { + dts_pass(api_name); + } else { + dts_fail(api_name); + } +} + +static void wait_for_service(char *api_name) +{ + int timeout = 0; + for (timeout; timeout < 180; timeout++) { + if (service_enabled) { + dts_message(api_name, "Find Routes!!!!"); + break; + } else { + dts_message(api_name, "Did not find Routes!!!!"); + sleep(1); + } + } +} + +static route_service_h g_service; +static route_preference_h g_pref; + +static bool route_service_found_callback(route_error_e error, int index, int total, route_h route, void *user_data) +{ + if (error != ROUTE_ERROR_NONE) { + return FALSE; + } + + service_enabled = TRUE; + return TRUE; +} + +void request_route_service_start() +{ + int ret, request_id; + location_coords_s origin, destination; + + ret = route_service_create(&g_service); + validate_and_next(__func__, ret, ROUTE_ERROR_NONE, "route_service_create() is failed"); + + ret = route_preference_create(&g_pref); + validate_and_next(__func__, ret, ROUTE_ERROR_NONE, "route_preference_create() is failed"); + + ret = route_service_set_preference(g_service, g_pref); + + origin.latitude = 37.564263; + origin.longitude = 126.974676; + destination.latitude = 37.55712; + destination.longitude = 126.99241; + + ret = route_service_find(g_service, origin, destination, NULL, 0, route_service_found_callback, NULL, &request_id); + validate_and_next(__func__, ret, ROUTE_ERROR_NONE, "route_service_find() is failed"); +} + +void request_route_service_stop() +{ + if (g_service) { + route_service_destroy(g_service); + } + + if (g_pref) { + route_preference_destroy(g_pref); + } +} + +static void startup(void) +{ + g_setenv("PKG_NAME", "com.samsung.capi-location-route-preference-test", 1); + g_setenv("LOCATION_TEST_ENABLE", "1", 1); + +#if !GLIB_CHECK_VERSION (2, 31, 0) + if (!g_thread_supported()) { + g_thread_init(NULL); + } +#endif + event_thread = g_thread_create(GmainThread, NULL, 1, NULL); + + request_route_service_start(); + wait_for_service(__func__); +} + +static void cleanup(void) +{ + request_route_service_stop(); + g_main_loop_quit(g_mainloop); + g_thread_join(event_thread); +} + +static void utc_location_route_preference_create_p(void) +{ + int ret = ROUTE_ERROR_NONE; + route_preference_h preference; + + ret = route_preference_create(&preference); + validate_eq(__func__, ret, ROUTE_ERROR_NONE); +} + +static void utc_location_route_preference_create_n(void) +{ + int ret = ROUTE_ERROR_NONE; + + ret = route_preference_create(NULL); + validate_eq(__func__, ret, ROUTE_ERROR_INVALID_PARAMETER); +} + +static bool capi_route_preference_address_to_avoid_cb(const char *address, void *user_data) +{ + return true; +} + +static void utc_location_route_preference_foreach_addresses_to_avoid_p(void) +{ + int ret = ROUTE_ERROR_NONE; + + ret = route_preference_foreach_addresses_to_avoid(g_pref, capi_route_preference_address_to_avoid_cb, NULL); + validate_eq(__func__, ret, ROUTE_ERROR_NONE); +} + +static void utc_location_route_preference_foreach_addresses_to_avoid_n(void) +{ + int ret = ROUTE_ERROR_NONE; + + ret = route_preference_foreach_addresses_to_avoid(g_pref, NULL, NULL); + validate_eq(__func__, ret, ROUTE_ERROR_INVALID_PARAMETER); +} + +static void utc_location_route_preference_foreach_addresses_to_avoid_n_02(void) +{ + int ret = ROUTE_ERROR_NONE; + + ret = route_preference_foreach_addresses_to_avoid(NULL, capi_route_preference_address_to_avoid_cb, NULL); + validate_eq(__func__, ret, ROUTE_ERROR_INVALID_PARAMETER); +} + +static bool capi_route_preference_area_to_avoid_cb(location_bounds_h area, void *user_data) +{ + return true; +} + +static void utc_location_route_preference_foreach_areas_to_avoid_p(void) +{ + int ret = ROUTE_ERROR_NONE; + + ret = route_preference_foreach_areas_to_avoid(g_pref, capi_route_preference_area_to_avoid_cb, NULL); + validate_eq(__func__, ret, ROUTE_ERROR_NONE); +} + +static void utc_location_route_preference_foreach_areas_to_avoid_n(void) +{ + int ret = ROUTE_ERROR_NONE; + + ret = route_preference_foreach_areas_to_avoid(g_pref, NULL, NULL); + validate_eq(__func__, ret, ROUTE_ERROR_INVALID_PARAMETER); +} + +static void utc_location_route_preference_foreach_areas_to_avoid_n_02(void) +{ + int ret = ROUTE_ERROR_NONE; + + ret = route_preference_foreach_areas_to_avoid(NULL, capi_route_preference_area_to_avoid_cb, NULL); + validate_eq(__func__, ret, ROUTE_ERROR_INVALID_PARAMETER); +} + +static bool capi_route_preference_constraint_cb(const char *constraint, void *user_data) +{ + return true; +} + +static void utc_location_route_preference_foreach_constraints_p(void) +{ + int ret = ROUTE_ERROR_NONE; + + ret = route_preference_foreach_constraints(g_pref, capi_route_preference_constraint_cb, NULL); + validate_eq(__func__, ret, ROUTE_ERROR_NONE); +} + +static void utc_location_route_preference_foreach_constraints_n(void) +{ + int ret = ROUTE_ERROR_NONE; + + ret = route_preference_foreach_constraints(g_pref, NULL, NULL); + validate_eq(__func__, ret, ROUTE_ERROR_INVALID_PARAMETER); + +} + +static void utc_location_route_preference_foreach_constraints_n_02(void) +{ + int ret = ROUTE_ERROR_NONE; + + ret = route_preference_foreach_constraints(NULL, capi_route_preference_constraint_cb, NULL); + validate_eq(__func__, ret, ROUTE_ERROR_INVALID_PARAMETER); + +} + +static bool capi_route_preference_property_cb(const char *key, const char *value, void *user_data) +{ + return true; +} + +static void utc_location_route_preference_foreach_properties_p(void) +{ + int ret = ROUTE_ERROR_NONE; + + ret = route_preference_foreach_properties(g_pref, capi_route_preference_property_cb, NULL); + validate_eq(__func__, ret, ROUTE_ERROR_NONE); +} + +static void utc_location_route_preference_foreach_properties_n(void) +{ + int ret = ROUTE_ERROR_NONE; + + ret = route_preference_foreach_properties(g_pref, NULL, NULL); + validate_eq(__func__, ret, ROUTE_ERROR_INVALID_PARAMETER); + +} + +static void utc_location_route_preference_foreach_properties_n_02(void) +{ + int ret = ROUTE_ERROR_NONE; + + ret = route_preference_foreach_properties(NULL, capi_route_preference_property_cb, NULL); + validate_eq(__func__, ret, ROUTE_ERROR_INVALID_PARAMETER); + +} + +static void utc_location_route_preference_get_geometry_bounding_box_p(void) +{ + int ret = ROUTE_ERROR_NONE; + location_coords_s top_left; + location_coords_s bottom_right; + + ret = route_preference_get_geometry_bounding_box(g_pref, &top_left, &bottom_right); + if (ret == ROUTE_ERROR_RESULT_NOT_FOUND) { + validate_eq(__func__, ret, ROUTE_ERROR_RESULT_NOT_FOUND); + } else { + validate_eq(__func__, ret, ROUTE_ERROR_NONE); + } +} + +static void utc_location_route_preference_get_geometry_bounding_box_n(void) +{ + int ret = ROUTE_ERROR_NONE; + location_coords_s top_left; + location_coords_s bottom_right; + + ret = route_preference_get_geometry_bounding_box(NULL, &top_left, &bottom_right); + validate_eq(__func__, ret, ROUTE_ERROR_INVALID_PARAMETER); +} + +static void utc_location_route_preference_get_geometry_bounding_box_n_02(void) +{ + int ret = ROUTE_ERROR_NONE; + location_coords_s bottom_right; + + ret = route_preference_get_geometry_bounding_box(g_pref, NULL, &bottom_right); + validate_eq(__func__, ret, ROUTE_ERROR_INVALID_PARAMETER); +} + +static void utc_location_route_preference_get_geometry_bounding_box_n_03(void) +{ + int ret = ROUTE_ERROR_NONE; + location_coords_s top_left; + + ret = route_preference_get_geometry_bounding_box(g_pref, &top_left, NULL); + validate_eq(__func__, ret, ROUTE_ERROR_INVALID_PARAMETER); +} + +static void utc_location_route_preference_get_max_results_p(void) +{ + int ret = ROUTE_ERROR_NONE; + int max_results; + + ret = route_preference_get_max_results(g_pref, &max_results); + validate_eq(__func__, ret, ROUTE_ERROR_NONE); +} + +static void utc_location_route_preference_get_max_results_n(void) +{ + int ret = ROUTE_ERROR_NONE; + + int max_results; + ret = route_preference_get_max_results(NULL, &max_results); + validate_eq(__func__, ret, ROUTE_ERROR_INVALID_PARAMETER); +} + +static void utc_location_route_preference_get_max_results_n_02(void) +{ + int ret = ROUTE_ERROR_NONE; + + ret = route_preference_get_max_results(g_pref, NULL); + validate_eq(__func__, ret, ROUTE_ERROR_INVALID_PARAMETER); +} + +static void utc_location_route_preference_get_goal_p(void) +{ + int ret = ROUTE_ERROR_NONE; + char *goal = NULL; + + ret = route_preference_get_goal(g_pref, &goal); + if (goal != NULL) { + free(goal); + } + + if (ret == ROUTE_ERROR_RESULT_NOT_FOUND) { + validate_eq(__func__, ret, ROUTE_ERROR_RESULT_NOT_FOUND); + } else { + validate_eq(__func__, ret, ROUTE_ERROR_NONE); + } +} + +static void utc_location_route_preference_get_goal_n(void) +{ + int ret = ROUTE_ERROR_NONE; + char *goal = NULL; + + ret = route_preference_get_goal(NULL, &goal); + validate_eq(__func__, ret, ROUTE_ERROR_INVALID_PARAMETER); +} + +static void utc_location_route_preference_get_goal_n_02(void) +{ + int ret = ROUTE_ERROR_NONE; + + ret = route_preference_get_goal(g_pref, NULL); + validate_eq(__func__, ret, ROUTE_ERROR_INVALID_PARAMETER); +} + +static void utc_location_route_preference_get_transport_mode_p(void) +{ + int ret = ROUTE_ERROR_NONE; + char *mode = NULL; + + ret = route_preference_get_transport_mode(g_pref, &mode); + if (mode != NULL) { + free(mode); + } + + if (ret == ROUTE_ERROR_RESULT_NOT_FOUND) { + validate_eq(__func__, ret, ROUTE_ERROR_RESULT_NOT_FOUND); + } else { + validate_eq(__func__, ret, ROUTE_ERROR_NONE); + } +} + +static void utc_location_route_preference_get_transport_mode_n(void) +{ + int ret = ROUTE_ERROR_NONE; + char *mode = NULL; + + ret = route_preference_get_transport_mode(NULL, &mode); + validate_eq(__func__, ret, ROUTE_ERROR_INVALID_PARAMETER); +} + +static void utc_location_route_preference_get_transport_mode_n_02(void) +{ + int ret = ROUTE_ERROR_NONE; + + ret = route_preference_get_transport_mode(g_pref, NULL); + validate_eq(__func__, ret, ROUTE_ERROR_INVALID_PARAMETER); +} + +static void utc_location_route_preference_is_geometry_used_p(void) +{ + bool ret = true; + + ret = route_preference_is_geometry_used(g_pref); + validate_eq_bool(__func__, ret, false); +} + +static void utc_location_route_preference_is_geometry_used_n(void) +{ + bool ret = true; + + ret = route_preference_is_geometry_used(NULL); + validate_eq_bool(__func__, ret, false); +} + +static void utc_location_route_preference_is_instruction_bounding_box_used_p(void) +{ + bool ret = true; + + ret = route_preference_is_instruction_bounding_box_used(g_pref); + validate_eq_bool(__func__, ret, false); +} + +static void utc_location_route_preference_is_instruction_bounding_box_used_n(void) +{ + bool ret = true; + + ret = route_preference_is_instruction_bounding_box_used(NULL); + validate_eq_bool(__func__, ret, false); +} + +static void utc_location_route_preference_is_instruction_geometry_used_p(void) +{ + bool ret = true; + + ret = route_preference_is_instruction_geometry_used(g_pref); + validate_eq_bool(__func__, ret, false); +} + +static void utc_location_route_preference_is_instruction_geometry_used_n(void) +{ + bool ret = true; + + ret = route_preference_is_instruction_geometry_used(NULL); + validate_eq_bool(__func__, ret, false); +} + +static void utc_location_route_preference_is_instruction_used_p(void) +{ + bool ret = true; + + ret = route_preference_is_instruction_used(g_pref); + validate_eq_bool(__func__, ret, false); +} + +static void utc_location_route_preference_is_instruction_used_n(void) +{ + bool ret = true; + + ret = route_preference_is_instruction_used(NULL); + validate_eq_bool(__func__, ret, false); +} + +static void utc_location_route_preference_is_traffic_data_used_p(void) +{ + bool ret = true; + + ret = route_preference_is_traffic_data_used(g_pref); + validate_eq_bool(__func__, ret, false); +} + +static void utc_location_route_preference_is_traffic_data_used_n(void) +{ + bool ret = true; + + ret = route_preference_is_traffic_data_used(NULL); + validate_eq_bool(__func__, ret, false); +} + +static void utc_location_route_preference_get_p(void) +{ + int ret = ROUTE_ERROR_NONE; + char *value = NULL; + + route_preference_set(g_pref, "LandmarkType", "hotel"); + + ret = route_preference_get(g_pref, "LandmarkType", &value); + validate_eq(__func__, ret, ROUTE_ERROR_NONE); +} + +static void utc_location_route_preference_get_n(void) +{ + int ret = ROUTE_ERROR_NONE; + char *value = NULL; + + ret = route_preference_get(NULL, "LandmarkType", &value); + validate_eq(__func__, ret, ROUTE_ERROR_INVALID_PARAMETER); +} + +static void utc_location_route_preference_get_n_02(void) +{ + int ret = ROUTE_ERROR_NONE; + char *value = NULL; + + ret = route_preference_get(g_pref, NULL, &value); + validate_eq(__func__, ret, ROUTE_ERROR_INVALID_PARAMETER); +} + +static void utc_location_route_preference_get_n_03(void) +{ + int ret = ROUTE_ERROR_NONE; + + ret = route_preference_get(g_pref, "LandmarkType", NULL); + validate_eq(__func__, ret, ROUTE_ERROR_INVALID_PARAMETER); +} + +static void utc_location_route_preference_set_p(void) +{ + int ret = ROUTE_ERROR_NONE; + + ret = route_preference_set(g_pref, "LandmarkType", "hotel"); + validate_eq(__func__, ret, ROUTE_ERROR_NONE); + +} + +static void utc_location_route_preference_set_n(void) +{ + int ret = ROUTE_ERROR_NONE; + + ret = route_preference_set(NULL, "LandmarkType", "hotel"); + validate_eq(__func__, ret, ROUTE_ERROR_INVALID_PARAMETER); +} + +static void utc_location_route_preference_set_n_02(void) +{ + int ret = ROUTE_ERROR_NONE; + + ret = route_preference_set(g_pref, NULL, "hotel"); + validate_eq(__func__, ret, ROUTE_ERROR_INVALID_PARAMETER); +} + +static void utc_location_route_preference_set_n_03(void) +{ + int ret = ROUTE_ERROR_NONE; + + ret = route_preference_set(g_pref, "LandmarkType", NULL); + validate_eq(__func__, ret, ROUTE_ERROR_INVALID_PARAMETER); +} + +static void utc_location_route_preference_add_address_to_avoid_p(void) +{ + int ret = ROUTE_ERROR_NONE; + + ret = route_preference_add_address_to_avoid(g_pref, "Grand Central Pky"); + validate_eq(__func__, ret, ROUTE_ERROR_NONE); + +} + +static void utc_location_route_preference_add_address_to_avoid_n(void) +{ + int ret = ROUTE_ERROR_NONE; + + ret = route_preference_add_address_to_avoid(NULL, "Grand Central Pky"); + validate_eq(__func__, ret, ROUTE_ERROR_INVALID_PARAMETER); +} + +static void utc_location_route_preference_add_address_to_avoid_n_02(void) +{ + int ret = ROUTE_ERROR_NONE; + + ret = route_preference_add_address_to_avoid(g_pref, NULL); + validate_eq(__func__, ret, ROUTE_ERROR_INVALID_PARAMETER); +} + +static void utc_location_route_preference_clear_addresses_to_avoid_p(void) +{ + int ret = ROUTE_ERROR_NONE; + + ret = route_preference_clear_addresses_to_avoid(g_pref); + validate_eq(__func__, ret, ROUTE_ERROR_NONE); + +} + +static void utc_location_route_preference_clear_addresses_to_avoid_n(void) +{ + int ret = ROUTE_ERROR_NONE; + + ret = route_preference_clear_addresses_to_avoid(NULL); + validate_eq(__func__, ret, ROUTE_ERROR_INVALID_PARAMETER); +} + +static void utc_location_route_preference_add_area_to_avoid_p(void) +{ + int ret = ROUTE_ERROR_NONE; + + location_bounds_h area; + location_coords_s top_left = { 30, 30 }; + location_coords_s bottom_right = { 10, 50 }; + location_bounds_create_rect(top_left, bottom_right, &area); + + ret = route_preference_add_area_to_avoid(g_pref, area); + validate_eq(__func__, ret, ROUTE_ERROR_NONE); + +} + +static void utc_location_route_preference_add_area_to_avoid_n(void) +{ + int ret = ROUTE_ERROR_NONE; + + location_bounds_h area; + location_coords_s top_left = { 30, 30 }; + location_coords_s bottom_right = { 10, 50 }; + location_bounds_create_rect(top_left, bottom_right, &area); + + ret = route_preference_add_area_to_avoid(NULL, area); + validate_eq(__func__, ret, ROUTE_ERROR_INVALID_PARAMETER); +} + +static void utc_location_route_preference_add_area_to_avoid_n_02(void) +{ + int ret = ROUTE_ERROR_NONE; + + ret = route_preference_add_area_to_avoid(g_pref, NULL); + validate_eq(__func__, ret, ROUTE_ERROR_INVALID_PARAMETER); +} + +static void utc_location_route_preference_clear_areas_to_avoid_p(void) +{ + int ret = ROUTE_ERROR_NONE; + + ret = route_preference_clear_areas_to_avoid(g_pref); + validate_eq(__func__, ret, ROUTE_ERROR_NONE); +} + +static void utc_location_route_preference_clear_areas_to_avoid_n(void) +{ + int ret = ROUTE_ERROR_NONE; + + ret = route_preference_clear_areas_to_avoid(NULL); + validate_eq(__func__, ret, ROUTE_ERROR_INVALID_PARAMETER); +} + +static void utc_location_route_preference_add_constraint_p(void) +{ + int ret = ROUTE_ERROR_NONE; + + ret = route_preference_add_constraint(g_pref, "BRIDGES"); + validate_eq(__func__, ret, ROUTE_ERROR_NONE); +} + +static void utc_location_route_preference_add_constraint_n(void) +{ + int ret = ROUTE_ERROR_NONE; + + ret = route_preference_add_constraint(NULL, "BRIDGES"); + validate_eq(__func__, ret, ROUTE_ERROR_INVALID_PARAMETER); +} + +static void utc_location_route_preference_add_constraint_n_02(void) +{ + int ret = ROUTE_ERROR_NONE; + + ret = route_preference_add_constraint(g_pref, NULL); + validate_eq(__func__, ret, ROUTE_ERROR_INVALID_PARAMETER); +} + +static void utc_location_route_preference_clear_constraints_p(void) +{ + int ret = ROUTE_ERROR_NONE; + + ret = route_preference_clear_constraints(g_pref); + validate_eq(__func__, ret, ROUTE_ERROR_NONE); +} + +static void utc_location_route_preference_clear_constraints_n(void) +{ + int ret = ROUTE_ERROR_NONE; + + ret = route_preference_clear_constraints(NULL); + validate_eq(__func__, ret, ROUTE_ERROR_INVALID_PARAMETER); +} + +static void utc_location_route_preference_set_geometry_bounding_box_p(void) +{ + int ret = ROUTE_ERROR_NONE; + location_coords_s top_left = { 30, 30 }; + location_coords_s bottom_right = { 10, 50 }; + + ret = route_preference_set_geometry_bounding_box(g_pref, top_left, bottom_right); + validate_eq(__func__, ret, ROUTE_ERROR_NONE); +} + +static void utc_location_route_preference_set_geometry_bounding_box_n(void) +{ + int ret = ROUTE_ERROR_NONE; + location_coords_s top_left = { 30, 30 }; + location_coords_s bottom_right = { 10, 50 }; + + ret = route_preference_set_geometry_bounding_box(NULL, top_left, bottom_right); + validate_eq(__func__, ret, ROUTE_ERROR_INVALID_PARAMETER); +} + +static void utc_location_route_preference_set_max_results_p(void) +{ + int ret = ROUTE_ERROR_NONE; + + ret = route_preference_set_max_results(g_pref, 5); + validate_eq(__func__, ret, ROUTE_ERROR_NONE); +} + +static void utc_location_route_preference_set_max_results_n(void) +{ + int ret = ROUTE_ERROR_NONE; + + ret = route_preference_set_max_results(NULL, 5); + validate_eq(__func__, ret, ROUTE_ERROR_INVALID_PARAMETER); +} + +static void utc_location_route_preference_set_goal_p(void) +{ + int ret = ROUTE_ERROR_NONE; + + ret = route_preference_set_goal(g_pref, "FASTEST"); + validate_eq(__func__, ret, ROUTE_ERROR_NONE); + +} + +static void utc_location_route_preference_set_goal_n(void) +{ + int ret = ROUTE_ERROR_NONE; + + ret = route_preference_set_goal(NULL, "FASTEST"); + validate_eq(__func__, ret, ROUTE_ERROR_INVALID_PARAMETER); +} + +static void utc_location_route_preference_set_goal_n_02(void) +{ + int ret = ROUTE_ERROR_NONE; + + ret = route_preference_set_goal(g_pref, NULL); + validate_eq(__func__, ret, ROUTE_ERROR_INVALID_PARAMETER); +} + +static void utc_location_route_preference_set_transport_mode_p(void) +{ + int ret = ROUTE_ERROR_NONE; + + ret = route_preference_set_transport_mode(g_pref, "Vehicle"); + validate_eq(__func__, ret, ROUTE_ERROR_NONE); +} + +static void utc_location_route_preference_set_transport_mode_n(void) +{ + int ret = ROUTE_ERROR_NONE; + + ret = route_preference_set_transport_mode(NULL, "CAR"); + validate_eq(__func__, ret, ROUTE_ERROR_INVALID_PARAMETER); + +} + +static void utc_location_route_preference_set_transport_mode_n_02(void) +{ + int ret = ROUTE_ERROR_NONE; + + ret = route_preference_set_transport_mode(g_pref, NULL); + validate_eq(__func__, ret, ROUTE_ERROR_INVALID_PARAMETER); + +} + +static void utc_location_route_preference_set_geometry_used_p(void) +{ + int ret = ROUTE_ERROR_NONE; + + ret = route_preference_set_geometry_used(g_pref, false); + validate_eq(__func__, ret, ROUTE_ERROR_NONE); + +} + +static void utc_location_route_preference_set_geometry_used_p_02(void) +{ + int ret = ROUTE_ERROR_NONE; + + ret = route_preference_set_geometry_used(g_pref, true); + validate_eq(__func__, ret, ROUTE_ERROR_NONE); +} + +static void utc_location_route_preference_set_geometry_used_n(void) +{ + int ret = ROUTE_ERROR_NONE; + + ret = route_preference_set_geometry_used(NULL, true); + validate_eq(__func__, ret, ROUTE_ERROR_INVALID_PARAMETER); + +} + +static void utc_location_route_preference_set_instruction_bounding_box_used_p(void) +{ + int ret = ROUTE_ERROR_NONE; + + ret = route_preference_set_instruction_bounding_box_used(g_pref, false); + validate_eq(__func__, ret, ROUTE_ERROR_NONE); + +} + +static void utc_location_route_preference_set_instruction_bounding_box_used_p_02(void) +{ + int ret = ROUTE_ERROR_NONE; + + ret = route_preference_set_instruction_bounding_box_used(g_pref, true); + validate_eq(__func__, ret, ROUTE_ERROR_NONE); + +} + +static void utc_location_route_preference_set_instruction_bounding_box_used_n(void) +{ + int ret = ROUTE_ERROR_NONE; + + ret = route_preference_set_instruction_bounding_box_used(NULL, true); + validate_eq(__func__, ret, ROUTE_ERROR_INVALID_PARAMETER); +} + +static void utc_location_route_preference_set_instruction_geometry_used_p(void) +{ + int ret = ROUTE_ERROR_NONE; + + ret = route_preference_set_instruction_geometry_used(g_pref, false); + validate_eq(__func__, ret, ROUTE_ERROR_NONE); +} + +static void utc_location_route_preference_set_instruction_geometry_used_p_02(void) +{ + int ret = ROUTE_ERROR_NONE; + + ret = route_preference_set_instruction_geometry_used(g_pref, true); + validate_eq(__func__, ret, ROUTE_ERROR_NONE); +} + +static void utc_location_route_preference_set_instruction_geometry_used_n(void) +{ + int ret = ROUTE_ERROR_NONE; + + ret = route_preference_set_instruction_geometry_used(NULL, true); + validate_eq(__func__, ret, ROUTE_ERROR_INVALID_PARAMETER); +} + +static void utc_location_route_preference_set_instruction_used_p(void) +{ + int ret = ROUTE_ERROR_NONE; + + ret = route_preference_set_instruction_used(g_pref, false); + validate_eq(__func__, ret, ROUTE_ERROR_NONE); +} + +static void utc_location_route_preference_set_instruction_used_p_02(void) +{ + int ret = ROUTE_ERROR_NONE; + + ret = route_preference_set_instruction_used(g_pref, true); + validate_eq(__func__, ret, ROUTE_ERROR_NONE); +} + +static void utc_location_route_preference_set_instruction_used_n(void) +{ + int ret = ROUTE_ERROR_NONE; + + ret = route_preference_set_instruction_used(NULL, true); + validate_eq(__func__, ret, ROUTE_ERROR_INVALID_PARAMETER); +} + +static void utc_location_route_preference_set_traffic_data_used_p(void) +{ + int ret = ROUTE_ERROR_NONE; + + ret = route_preference_set_traffic_data_used(g_pref, false); + validate_eq(__func__, ret, ROUTE_ERROR_NONE); +} + +static void utc_location_route_preference_set_traffic_data_used_p_02(void) +{ + int ret = ROUTE_ERROR_NONE; + + ret = route_preference_set_traffic_data_used(g_pref, true); + validate_eq(__func__, ret, ROUTE_ERROR_NONE); +} + +static void utc_location_route_preference_set_traffic_data_used_n(void) +{ + int ret = ROUTE_ERROR_NONE; + + ret = route_preference_set_traffic_data_used(NULL, true); + validate_eq(__func__, ret, ROUTE_ERROR_INVALID_PARAMETER); +} + +static void utc_location_route_preference_is_area_to_avoid_supported_p(void) +{ + bool ret = true; + + ret = route_preference_is_area_to_avoid_supported(g_service, LOCATION_BOUNDS_RECT); + validate_eq_bool(__func__, ret, false); +} + +static void utc_location_route_preference_is_area_to_avoid_supported_p_02(void) +{ + bool ret = true; + + ret = route_preference_is_area_to_avoid_supported(g_service, LOCATION_BOUNDS_CIRCLE); + validate_eq_bool(__func__, ret, true); +} + +static void utc_location_route_preference_is_area_to_avoid_supported_p_03(void) +{ + bool ret = true; + + ret = route_preference_is_area_to_avoid_supported(g_service, LOCATION_BOUNDS_POLYGON); + validate_eq_bool(__func__, ret, false); +} + +static void utc_location_route_preference_is_area_to_avoid_supported_n(void) +{ + bool ret = true; + + ret = route_preference_is_area_to_avoid_supported(NULL, LOCATION_BOUNDS_CIRCLE); + validate_eq_bool(__func__, ret, false); +} + +static void utc_location_route_preference_is_address_to_avoid_supported_p(void) +{ + bool ret = true; + + ret = route_preference_is_address_to_avoid_supported(g_service); + validate_eq_bool(__func__, ret, true); +} + +static void utc_location_route_preference_is_address_to_avoid_supported_n(void) +{ + bool ret = true; + + ret = route_preference_is_address_to_avoid_supported(NULL); + validate_eq_bool(__func__, ret, false); +} + +static void utc_location_route_preference_is_geometry_bounding_box_supported_p(void) +{ + bool ret = true; + + ret = route_preference_is_geometry_bounding_box_supported(g_service); + validate_eq_bool(__func__, ret, true); +} + +static void utc_location_route_preference_is_geometry_bounding_box_supported_n(void) +{ + bool ret = true; + + ret = route_preference_is_geometry_bounding_box_supported(NULL); + validate_eq_bool(__func__, ret, false); +} + +static void utc_location_route_preference_is_geometry_supported_p(void) +{ + bool ret = true; + + ret = route_preference_is_geometry_supported(g_service); + validate_eq_bool(__func__, ret, true); +} + +static void utc_location_route_preference_is_geometry_supported_n(void) +{ + bool ret = true; + + ret = route_preference_is_geometry_supported(NULL); + validate_eq_bool(__func__, ret, false); +} + +static void utc_location_route_preference_is_instruction_geometry_supported_p(void) +{ + bool ret = true; + + ret = route_preference_is_instruction_geometry_supported(g_service); + validate_eq_bool(__func__, ret, true); +} + +static void utc_location_route_preference_is_instruction_geometry_supported_n(void) +{ + bool ret = true; + + ret = route_preference_is_instruction_geometry_supported(NULL); + validate_eq_bool(__func__, ret, false); +} + +static void utc_location_route_preference_is_instruction_bounding_box_supported_p(void) +{ + bool ret = true; + + ret = route_preference_is_instruction_bounding_box_supported(g_service); + validate_eq_bool(__func__, ret, true); +} + +static void utc_location_route_preference_is_instruction_bounding_box_supported_n(void) +{ + bool ret = true; + + ret = route_preference_is_instruction_bounding_box_supported(NULL); + validate_eq_bool(__func__, ret, false); +} + +static void utc_location_route_preference_is_instruction_supported_p(void) +{ + bool ret = true; + + ret = route_preference_is_instruction_supported(g_service); + validate_eq_bool(__func__, ret, true); +} + +static void utc_location_route_preference_is_instruction_supported_n(void) +{ + bool ret = true; + + ret = route_preference_is_instruction_supported(NULL); + validate_eq_bool(__func__, ret, false); +} + +static void utc_location_route_preference_is_traffic_data_supported_p(void) +{ + bool ret = true; + + ret = route_preference_is_traffic_data_supported(g_service); + validate_eq_bool(__func__, ret, true); +} + +static void utc_location_route_preference_is_traffic_data_supported_n(void) +{ + bool ret = true; + + ret = route_preference_is_traffic_data_supported(NULL); + validate_eq_bool(__func__, ret, false); +} + +static bool capi_route_preference_available_constraint_cb(const char *constraint, void *user_data) +{ + return true; +} + +static void utc_location_route_preference_foreach_available_constraints_p(void) +{ + int ret = ROUTE_ERROR_NONE; + + ret = route_preference_foreach_available_constraints(g_service, capi_route_preference_available_constraint_cb, NULL); + validate_eq(__func__, ret, ROUTE_ERROR_NONE); +} + +static void utc_location_route_preference_foreach_available_constraints_n(void) +{ + int ret = ROUTE_ERROR_NONE; + + ret = route_preference_foreach_available_constraints(NULL, capi_route_preference_available_constraint_cb, NULL); + validate_eq(__func__, ret, ROUTE_ERROR_INVALID_PARAMETER); +} + +static void utc_location_route_preference_foreach_available_constraints_n_02(void) +{ + int ret = ROUTE_ERROR_NONE; + + ret = route_preference_foreach_available_constraints(g_service, NULL, NULL); + validate_eq(__func__, ret, ROUTE_ERROR_INVALID_PARAMETER); +} + +static bool capi_route_preference_available_goal_cb(const char *goal, void *user_data) +{ + return true; +} + +static void utc_location_route_preference_foreach_available_goals_p(void) +{ + int ret = ROUTE_ERROR_NONE; + + ret = route_preference_foreach_available_goals(g_service, capi_route_preference_available_goal_cb, NULL); + validate_eq(__func__, ret, ROUTE_ERROR_NONE); +} + +static void utc_location_route_preference_foreach_available_goals_n(void) +{ + int ret = ROUTE_ERROR_NONE; + + ret = route_preference_foreach_available_goals(NULL, capi_route_preference_available_goal_cb, NULL); + validate_eq(__func__, ret, ROUTE_ERROR_INVALID_PARAMETER); +} + +static void utc_location_route_preference_foreach_available_goals_n_02(void) +{ + int ret = ROUTE_ERROR_NONE; + + ret = route_preference_foreach_available_goals(g_service, NULL, NULL); + validate_eq(__func__, ret, ROUTE_ERROR_INVALID_PARAMETER); +} + +static bool capi_route_preference_available_transport_mode_cb(const char *mode, void *user_data) +{ + return true; +} + +static void utc_location_route_preference_foreach_available_transport_modes_p(void) +{ + int ret = ROUTE_ERROR_NONE; + + ret = + route_preference_foreach_available_transport_modes(g_service, capi_route_preference_available_transport_mode_cb, + NULL); + validate_eq(__func__, ret, ROUTE_ERROR_NONE); + +} + +static void utc_location_route_preference_foreach_available_transport_modes_n(void) +{ + int ret = ROUTE_ERROR_NONE; + + ret = route_preference_foreach_available_transport_modes(NULL, capi_route_preference_available_transport_mode_cb, NULL); + validate_eq(__func__, ret, ROUTE_ERROR_INVALID_PARAMETER); +} + +static void utc_location_route_preference_foreach_available_transport_modes_n_02(void) +{ + int ret = ROUTE_ERROR_NONE; + + ret = route_preference_foreach_available_transport_modes(g_service, NULL, NULL); + validate_eq(__func__, ret, ROUTE_ERROR_INVALID_PARAMETER); +} + +static bool capi_route_preference_available_property_key_cb(const char *key, void *user_data) +{ + return true; +} + +static void utc_location_route_preference_foreach_available_property_keys_p(void) +{ + int ret = ROUTE_ERROR_NONE; + + ret = + route_preference_foreach_available_property_keys(g_service, capi_route_preference_available_property_key_cb, NULL); + validate_eq(__func__, ret, ROUTE_ERROR_NONE); + +} + +static void utc_location_route_preference_foreach_available_property_keys_n(void) +{ + int ret = ROUTE_ERROR_NONE; + + ret = route_preference_foreach_available_property_keys(NULL, capi_route_preference_available_property_key_cb, NULL); + validate_eq(__func__, ret, ROUTE_ERROR_INVALID_PARAMETER); +} + +static void utc_location_route_preference_foreach_available_property_keys_n_02(void) +{ + int ret = ROUTE_ERROR_NONE; + + ret = route_preference_foreach_available_property_keys(g_service, NULL, NULL); + validate_eq(__func__, ret, ROUTE_ERROR_INVALID_PARAMETER); +} + +static bool capi_route_preference_available_property_value_cb(const char *value, void *user_data) +{ + return true; +} + +static void utc_location_route_preference_foreach_available_property_values_p(void) +{ + int ret = ROUTE_ERROR_NONE; + + ret = + route_preference_foreach_available_property_values(g_service, "LandmarkType", + capi_route_preference_available_property_value_cb, NULL); + validate_eq(__func__, ret, ROUTE_ERROR_NONE); + +} + +static void utc_location_route_preference_foreach_available_property_values_n(void) +{ + int ret = ROUTE_ERROR_NONE; + + ret = + route_preference_foreach_available_property_values(NULL, "LandmarkType", + capi_route_preference_available_property_value_cb, NULL); + validate_eq(__func__, ret, ROUTE_ERROR_INVALID_PARAMETER); +} + +static void utc_location_route_preference_foreach_available_property_values_n_02(void) +{ + int ret = ROUTE_ERROR_NONE; + + ret = + route_preference_foreach_available_property_values(g_service, NULL, + capi_route_preference_available_property_value_cb, NULL); + validate_eq(__func__, ret, ROUTE_ERROR_INVALID_PARAMETER); +} + +static void utc_location_route_preference_foreach_available_property_values_n_03(void) +{ + int ret = ROUTE_ERROR_NONE; + + ret = route_preference_foreach_available_property_values(g_service, "LandmarkType", NULL, NULL); + validate_eq(__func__, ret, ROUTE_ERROR_INVALID_PARAMETER); +} + +static void utc_location_route_preference_destroy_p(void) +{ + int ret = ROUTE_ERROR_NONE; + + ret = route_preference_destroy(g_pref); + validate_eq(__func__, ret, ROUTE_ERROR_NONE); +} + +static void utc_location_route_preference_destroy_n(void) +{ + int ret = ROUTE_ERROR_NONE; + + ret = route_preference_destroy(NULL); + validate_eq(__func__, ret, ROUTE_ERROR_INVALID_PARAMETER); +} diff --git a/TC/testcase/utc_location_route_service.c b/TC/testcase/utc_location_route_service.c new file mode 100644 index 0000000..9522ce2 --- /dev/null +++ b/TC/testcase/utc_location_route_service.c @@ -0,0 +1,295 @@ +/* +* Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +#include + +#include +#include +#include + +enum { + POSITIVE_TC_IDX = 0x01, + NEGATIVE_TC_IDX, +}; + +static void startup(void); +static void cleanup(void); + +void (*tet_startup) (void) = startup; +void (*tet_cleanup) (void) = cleanup; + +static void utc_location_route_service_create_p(void); +static void utc_location_route_service_create_n(void); +static void utc_location_route_service_get_preference_p(void); +static void utc_location_route_service_get_preference_n(void); +static void utc_location_route_service_get_preference_n_02(void); +static void utc_location_route_service_set_preference_p(void); +static void utc_location_route_service_set_preference_n(void); +static void utc_location_route_service_set_preference_n_02(void); +static void utc_location_route_service_find_p(void); +static void utc_location_route_service_find_n(void); +static void utc_location_route_service_find_n_02(void); +static void utc_location_route_service_cancel_p(void); +static void utc_location_route_service_cancel_n(void); +static void utc_location_route_service_destroy_p(void); +static void utc_location_route_service_destroy_n(void); + +struct tet_testlist tet_testlist[] = { + {utc_location_route_service_create_p, POSITIVE_TC_IDX}, + {utc_location_route_service_create_n, NEGATIVE_TC_IDX}, + {utc_location_route_service_get_preference_p, POSITIVE_TC_IDX}, + {utc_location_route_service_get_preference_n, NEGATIVE_TC_IDX}, + {utc_location_route_service_get_preference_n_02, NEGATIVE_TC_IDX}, + {utc_location_route_service_set_preference_p, POSITIVE_TC_IDX}, + {utc_location_route_service_set_preference_n, NEGATIVE_TC_IDX}, + {utc_location_route_service_set_preference_n_02, NEGATIVE_TC_IDX}, + {utc_location_route_service_find_p, POSITIVE_TC_IDX}, + {utc_location_route_service_find_n, NEGATIVE_TC_IDX}, + {utc_location_route_service_find_n_02, NEGATIVE_TC_IDX}, + {utc_location_route_service_cancel_p, POSITIVE_TC_IDX}, + {utc_location_route_service_cancel_n, NEGATIVE_TC_IDX}, + {utc_location_route_service_destroy_p, POSITIVE_TC_IDX}, + {utc_location_route_service_destroy_n, NEGATIVE_TC_IDX}, + + {NULL, 0}, +}; + +static GMainLoop *g_mainloop = NULL; +static GThread *event_thread; + +gpointer GmainThread(gpointer data) +{ + g_mainloop = g_main_loop_new(NULL, 0); + g_main_loop_run(g_mainloop); + + return NULL; +} + +static void validate_and_next(char *api_name, int act_ret, int ext_ret, char *fail_msg) +{ + dts_message(api_name, "Actual Result : %d, Expected Result : %d", act_ret, ext_ret); + if (act_ret != ext_ret) { + dts_message(api_name, "Fail Message: %s", fail_msg); + dts_fail(api_name); + } +} + +static void validate_eq(char *api_name, int act_ret, int ext_ret) +{ + dts_message(api_name, "Actual Result : %d, Expected Result : %d", act_ret, ext_ret); + if (act_ret == ext_ret) { + dts_pass(api_name); + } else { + dts_fail(api_name); + } +} + +static void startup(void) +{ + g_setenv("PKG_NAME", "com.samsung.capi-location-route-service-test", 1); + g_setenv("LOCATION_TEST_ENABLE", "1", 1); + +#if !GLIB_CHECK_VERSION (2, 31, 0) + if (!g_thread_supported()) { + g_thread_init(NULL); + } +#endif + event_thread = g_thread_create(GmainThread, NULL, 1, NULL); +} + +static void cleanup(void) +{ + g_main_loop_quit(g_mainloop); + g_thread_join(event_thread); +} + +static route_service_h g_service; +int g_request_id; +static bool service_enabled = FALSE; + +static void wait_for_service(char *api_name) +{ + int timeout = 0; + for (timeout; timeout < 180; timeout++) { + if (service_enabled) { + dts_message(api_name, "Find Routes!!!!"); + break; + } else { + dts_message(api_name, "Did not find Routes!!!!"); + sleep(1); + } + } +} + +static void utc_location_route_service_create_p(void) +{ + int ret = ROUTE_ERROR_NONE; + + ret = route_service_create(&g_service); + validate_eq(__func__, ret, ROUTE_ERROR_NONE); +} + +static void utc_location_route_service_create_n(void) +{ + int ret = ROUTE_ERROR_NONE; + + ret = route_service_create(NULL); + validate_eq(__func__, ret, ROUTE_ERROR_INVALID_PARAMETER); +} + +static void utc_location_route_service_get_preference_p(void) +{ + int ret = ROUTE_ERROR_NONE; + + route_preference_h pref = NULL; + ret = route_preference_create(&pref); + validate_and_next(__func__, ret, ROUTE_ERROR_NONE, "route_preference_create() is failed"); + + ret = route_service_get_preference(g_service, &pref); + validate_eq(__func__, ret, ROUTE_ERROR_NONE); +} + +static void utc_location_route_service_get_preference_n(void) +{ + int ret = ROUTE_ERROR_NONE; + + ret = route_service_get_preference(g_service, NULL); + validate_eq(__func__, ret, ROUTE_ERROR_INVALID_PARAMETER); +} + +static void utc_location_route_service_get_preference_n_02(void) +{ + int ret = ROUTE_ERROR_NONE; + + route_preference_h pref; + ret = route_preference_create(&pref); + validate_and_next(__func__, ret, ROUTE_ERROR_NONE, "route_preference_create() is failed"); + + ret = route_service_get_preference(NULL, pref); + validate_eq(__func__, ret, ROUTE_ERROR_INVALID_PARAMETER); +} + +static void utc_location_route_service_set_preference_p(void) +{ + int ret = ROUTE_ERROR_NONE; + + route_preference_h pref = NULL; + ret = route_preference_create(&pref); + validate_and_next(__func__, ret, ROUTE_ERROR_NONE, "route_preference_create() is failed"); + + ret = route_service_set_preference(g_service, pref); + validate_eq(__func__, ret, ROUTE_ERROR_NONE); +} + +static void utc_location_route_service_set_preference_n(void) +{ + int ret = ROUTE_ERROR_NONE; + + route_preference_h pref; + ret = route_preference_create(&pref); + validate_and_next(__func__, ret, ROUTE_ERROR_NONE, "route_preference_create() is failed"); + + ret = route_service_set_preference(g_service, NULL); + validate_eq(__func__, ret, ROUTE_ERROR_INVALID_PARAMETER); +} + +static void utc_location_route_service_set_preference_n_02(void) +{ + int ret = ROUTE_ERROR_NONE; + + route_preference_h pref; + ret = route_preference_create(&pref); + validate_and_next(__func__, ret, ROUTE_ERROR_NONE, "route_preference_create() is failed"); + + ret = route_service_set_preference(NULL, pref); + validate_eq(__func__, ret, ROUTE_ERROR_INVALID_PARAMETER); +} + +static bool capi_route_service_found_cb(route_error_e error, int index, int total, route_h route, void *user_data) +{ + if (error != ROUTE_ERROR_NONE) { + return FALSE; + } + + service_enabled = TRUE; + return TRUE; +} + +static void utc_location_route_service_find_p(void) +{ + int ret = ROUTE_ERROR_NONE; + location_coords_s origin = { 37.564263, 126.974676 }; + location_coords_s destination = { 37.557120, 126.992410 }; + + ret = route_service_find(g_service, origin, destination, NULL, 0, capi_route_service_found_cb, NULL, &g_request_id); + validate_eq(__func__, ret, ROUTE_ERROR_NONE); + wait_for_service("route_service_find"); +} + +static void utc_location_route_service_find_n(void) +{ + int ret = ROUTE_ERROR_NONE; + int request_id; + location_coords_s origin = { 37.564263, 126.974676 }; + location_coords_s destination = { 37.557120, 126.992410 }; + + ret = route_service_find(NULL, origin, destination, NULL, 0, capi_route_service_found_cb, NULL, &request_id); + validate_eq(__func__, ret, ROUTE_ERROR_INVALID_PARAMETER); +} + +static void utc_location_route_service_find_n_02(void) +{ + int ret = ROUTE_ERROR_NONE; + int request_id; + location_coords_s origin = { 37.564263, 126.974676 }; + location_coords_s destination = { 37.557120, 126.992410 }; + + ret = route_service_find(g_service, origin, destination, NULL, 0, NULL, NULL, &request_id); + validate_eq(__func__, ret, ROUTE_ERROR_INVALID_PARAMETER); +} + +static void utc_location_route_service_cancel_p(void) +{ + int ret = ROUTE_ERROR_NONE; + + ret = route_service_cancel(g_service, g_request_id); + validate_eq(__func__, ret, ROUTE_ERROR_NONE); +} + +static void utc_location_route_service_cancel_n(void) +{ + int ret = ROUTE_ERROR_NONE; + + ret = route_service_cancel(NULL, g_request_id); + validate_eq(__func__, ret, ROUTE_ERROR_INVALID_PARAMETER); + +} + +static void utc_location_route_service_destroy_p(void) +{ + int ret = ROUTE_ERROR_NONE; + + ret = route_service_destroy(g_service); + validate_eq(__func__, ret, ROUTE_ERROR_NONE); +} + +static void utc_location_route_service_destroy_n(void) +{ + int ret = ROUTE_ERROR_NONE; + + ret = route_service_destroy(NULL); + validate_eq(__func__, ret, ROUTE_ERROR_INVALID_PARAMETER); +} diff --git a/TC/tet_scen b/TC/tet_scen new file mode 100755 index 0000000..03f029a --- /dev/null +++ b/TC/tet_scen @@ -0,0 +1,7 @@ +all + ^TEST +##### Scenarios for TEST ##### + +# Test scenario +TEST + :include:/testcase/tslist diff --git a/TC/tetbuild.cfg b/TC/tetbuild.cfg new file mode 100644 index 0000000..f7eda55 --- /dev/null +++ b/TC/tetbuild.cfg @@ -0,0 +1,5 @@ +TET_OUTPUT_CAPTURE=True # capture option for build operation checking +TET_BUILD_TOOL=make # build with using make command +TET_BUILD_FILE=-f Makefile # execution file (Makefile) for build +TET_API_COMPLIANT=True # use TET API in Test Case ? +TET_PASS_TC_NAME=True # report passed TC name in Journal file? diff --git a/TC/tetclean.cfg b/TC/tetclean.cfg new file mode 100644 index 0000000..02d7030 --- /dev/null +++ b/TC/tetclean.cfg @@ -0,0 +1,5 @@ +TET_OUTPUT_CAPTURE=True # capture option +TET_CLEAN_TOOL= make clean # clean tool +TET_CLEAN_FILE= Makefile # file for clean +TET_API_COMPLIANT=True # TET API useage +TET_PASS_TC_NAME=True # showing name , passed TC diff --git a/TC/tetexec.cfg b/TC/tetexec.cfg new file mode 100644 index 0000000..ef3e452 --- /dev/null +++ b/TC/tetexec.cfg @@ -0,0 +1,5 @@ +TET_OUTPUT_CAPTURE=True # capturing execution or not +TET_EXEC_TOOL= # ex) exec : execution tool set up/ Optional +TET_EXEC_FILE= # ex) exectool : execution file/ Optional +TET_API_COMPLIANT=True # Test case or Tool usesTET API? +TET_PASS_TC_NAME=True # showing Passed TC name ? diff --git a/debian/changelog b/debian/changelog index fbb8283..8d6ee81 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,7 +1,27 @@ +capi-location-route (0.1.0-6) unstable; urgency=low + + * Fix bugs when checking returned value + * Tag: capi-location-route_0.1.0-6 + + -- Minjune Kim Mon, 13 Aug 2012 15:40:15 +0900 + +capi-location-route (0.1.0-5) unstable; urgency=low + + * Seperate map service from location service + * Tag: capi-location-route_0.1.0-5 + + -- Minjune Kim Fri, 27 Jul 2012 20:07:36 +0900 + +capi-location-route (0.1.0-4) unstable; urgency=low + + * Support developer mode + * Tag: capi-location-route_0.1.0-4 + + -- Minjune Kim Thu, 19 Jul 2012 19:53:27 +0900 + capi-location-route (0.1.0-3) unstable; urgency=low * add get transport mode in route step - * Git: slp-source.sec.samsung.net:slp/api/route * Tag: capi-location-route_0.1.0-3 -- Genie Kim Tue, 27 Mar 2012 21:30:53 +0900 @@ -9,7 +29,6 @@ capi-location-route (0.1.0-3) unstable; urgency=low capi-location-route (0.1.0-2) unstable; urgency=low * add TC for route_service / route_preference / route - * Git: slp-source.sec.samsung.net:slp/api/route * Tag: capi-location-route_0.1.0-2 -- Genie Kim Wed, 21 Mar 2012 20:36:24 +0900 @@ -17,7 +36,6 @@ capi-location-route (0.1.0-2) unstable; urgency=low capi-location-route (0.1.0-1) unstable; urgency=low * Initial release - * Git: slp-source.sec.samsung.net:slp/api/route * Tag: capi-location-route_0.1.0-1 -- Genie Kim Mon, 19 Mar 2012 00:00:00 +0900 diff --git a/include/route_private.h b/include/route_private.h index 61bf14b..c076f85 100644 --- a/include/route_private.h +++ b/include/route_private.h @@ -18,6 +18,7 @@ #define __TIZEN_LOCATION_ROUTE_PRIVATE_H__ #include +#include #include "route_preference.h" @@ -27,7 +28,7 @@ extern "C" { typedef struct _route_service_s{ - LocationObject* object; + LocationMapObject* object; route_preference_h route_preference; } route_service_s; diff --git a/packaging/capi-location-route.spec b/packaging/capi-location-route.spec index ef998ab..93e657f 100644 --- a/packaging/capi-location-route.spec +++ b/packaging/capi-location-route.spec @@ -1,7 +1,7 @@ Name: capi-location-route Summary: A Location Route library in Tizen Native API Version: 0.1.0 -Release: 2 +Release: 1 Group: TO_BE/FILLED_IN License: TO BE FILLED IN Source0: %{name}-%{version}.tar.gz diff --git a/src/route_preference.c b/src/route_preference.c index 52c719f..36258a9 100644 --- a/src/route_preference.c +++ b/src/route_preference.c @@ -609,17 +609,17 @@ bool route_preference_is_area_to_avoid_supported(route_service_h service, locati switch (type) { case LOCATION_BOUNDS_RECT: ret = - (bool) location_is_supported_map_provider_capability(handle->object, + (bool) location_map_is_supported_provider_capability(handle->object, MAP_SERVICE_ROUTE_REQUEST_RECT_AREA_TO_AVOID); break; case LOCATION_BOUNDS_CIRCLE: ret = - (bool) location_is_supported_map_provider_capability(handle->object, + (bool) location_map_is_supported_provider_capability(handle->object, MAP_SERVICE_ROUTE_REQUEST_CIRCLE_AREA_TO_AVOID); break; case LOCATION_BOUNDS_POLYGON: ret = - (bool) location_is_supported_map_provider_capability(handle->object, + (bool) location_map_is_supported_provider_capability(handle->object, MAP_SERVICE_ROUTE_REQUEST_POLYGON_AREA_TO_AVOID); break; default: @@ -635,7 +635,7 @@ bool route_preference_is_address_to_avoid_supported(route_service_h service) ROUTE_PREFERENCE_NULL_ARG_CHECK_RETURN_FALSE(service); route_service_s *handle = (route_service_s *) service; - bool ret = (bool) location_is_supported_map_provider_capability(handle->object, + bool ret = (bool) location_map_is_supported_provider_capability(handle->object, MAP_SERVICE_ROUTE_REQUEST_FREEFORM_ADDR_TO_AVOID); return ret; @@ -647,7 +647,7 @@ bool route_preference_is_geometry_bounding_box_supported(route_service_h service route_service_s *handle = (route_service_s *) service; bool ret = - (bool) location_is_supported_map_provider_capability(handle->object, MAP_SERVICE_ROUTE_PREF_GEOMETRY_BOUNDING_BOX); + (bool) location_map_is_supported_provider_capability(handle->object, MAP_SERVICE_ROUTE_PREF_GEOMETRY_BOUNDING_BOX); return ret; } @@ -658,7 +658,7 @@ bool route_preference_is_geometry_supported(route_service_h service) route_service_s *handle = (route_service_s *) service; bool ret = - (bool) location_is_supported_map_provider_capability(handle->object, MAP_SERVICE_ROUTE_PREF_GEOMETRY_RETRIEVAL); + (bool) location_map_is_supported_provider_capability(handle->object, MAP_SERVICE_ROUTE_PREF_GEOMETRY_RETRIEVAL); return ret; } @@ -669,7 +669,7 @@ bool route_preference_is_instruction_geometry_supported(route_service_h service) route_service_s *handle = (route_service_s *) service; bool ret = - (bool) location_is_supported_map_provider_capability(handle->object, MAP_SERVICE_ROUTE_PREF_INSTRUCTION_GEOMETRY); + (bool) location_map_is_supported_provider_capability(handle->object, MAP_SERVICE_ROUTE_PREF_INSTRUCTION_GEOMETRY); return ret; } @@ -679,7 +679,7 @@ bool route_preference_is_instruction_bounding_box_supported(route_service_h serv ROUTE_PREFERENCE_NULL_ARG_CHECK_RETURN_FALSE(service); route_service_s *handle = (route_service_s *) service; - bool ret = (bool) location_is_supported_map_provider_capability(handle->object, + bool ret = (bool) location_map_is_supported_provider_capability(handle->object, MAP_SERVICE_ROUTE_PREF_INSTRUCTION_BOUNDING_BOX); return ret; @@ -691,7 +691,7 @@ bool route_preference_is_instruction_supported(route_service_h service) route_service_s *handle = (route_service_s *) service; bool ret = - (bool) location_is_supported_map_provider_capability(handle->object, MAP_SERVICE_ROUTE_PREF_INSTRUCTION_RETRIEVAL); + (bool) location_map_is_supported_provider_capability(handle->object, MAP_SERVICE_ROUTE_PREF_INSTRUCTION_RETRIEVAL); return ret; } @@ -702,7 +702,7 @@ bool route_preference_is_traffic_data_supported(route_service_h service) route_service_s *handle = (route_service_s *) service; bool ret = - (bool) location_is_supported_map_provider_capability(handle->object, MAP_SERVICE_ROUTE_PREF_REALTIME_TRAFFIC); + (bool) location_map_is_supported_provider_capability(handle->object, MAP_SERVICE_ROUTE_PREF_REALTIME_TRAFFIC); return ret; } @@ -716,8 +716,8 @@ int route_preference_foreach_available_constraints(route_service_h service, rout route_service_s *handle = (route_service_s *) service; LocationMapServiceType type = MAP_SERVICE_ROUTE_REQUEST_FEATURE_TO_AVOID; GList *constraint_list = NULL; - int ret = location_get_map_provider_capability_key(handle->object, type, &constraint_list); - if (!ret) { + int ret = location_map_get_provider_capability_key(handle->object, type, &constraint_list); + if (ret) { return _convert_error_code(ret, __FUNCTION__); } @@ -741,8 +741,8 @@ int route_preference_foreach_available_goals(route_service_h service, route_pref route_service_s *handle = (route_service_s *) service; LocationMapServiceType type = MAP_SERVICE_ROUTE_PREF_TYPE; GList *goal_list = NULL; - int ret = location_get_map_provider_capability_key(handle->object, type, &goal_list); - if (!ret) { + int ret = location_map_get_provider_capability_key(handle->object, type, &goal_list); + if (ret) { return _convert_error_code(ret, __FUNCTION__); } @@ -766,8 +766,8 @@ int route_preference_foreach_available_transport_modes(route_service_h service, route_service_s *handle = (route_service_s *) service; LocationMapServiceType type = MAP_SERVICE_ROUTE_PREF_TRANSPORT_MODE; GList *mode_list = NULL; - int ret = location_get_map_provider_capability_key(handle->object, type, &mode_list); - if (!ret) { + int ret = location_map_get_provider_capability_key(handle->object, type, &mode_list); + if (ret) { return _convert_error_code(ret, __FUNCTION__); } @@ -791,8 +791,8 @@ int route_preference_foreach_available_property_keys(route_service_h service, route_service_s *handle = (route_service_s *) service; LocationMapServiceType type = MAP_SERVICE_ROUTE_PREF_PROPERTY; GList *key_list = NULL; - int ret = location_get_map_provider_capability_key(handle->object, type, &key_list); - if (!ret) { + int ret = location_map_get_provider_capability_key(handle->object, type, &key_list); + if (ret) { return _convert_error_code(ret, __FUNCTION__); } @@ -817,8 +817,8 @@ int route_preference_foreach_available_property_values(route_service_h service, route_service_s *handle = (route_service_s *) service; LocationMapServiceType type = MAP_SERVICE_ROUTE_PREF_PROPERTY; GList *key_list = NULL; - int ret = location_get_map_provider_capability_key(handle->object, type, &key_list); - if (!ret) { + int ret = location_map_get_provider_capability_key(handle->object, type, &key_list); + if (ret) { return _convert_error_code(ret, __FUNCTION__); } diff --git a/src/route_service.c b/src/route_service.c index 7d19a04..0e19e05 100644 --- a/src/route_service.c +++ b/src/route_service.c @@ -161,10 +161,10 @@ int route_service_create(route_service_h * service) ROUTE_SERVICE_PRINT_ERROR_CODE_RETURN(ROUTE_ERROR_OUT_OF_MEMORY); } - handle->object = location_new(LOCATION_METHOD_HYBRID); + handle->object = location_map_new(NULL); if (handle->object == NULL) { free(handle); - LOGE("Fail to location_new"); + LOGE("Fail to location_map_new"); ROUTE_SERVICE_PRINT_ERROR_CODE_RETURN(ROUTE_ERROR_SERVICE_NOT_AVAILABLE); } @@ -183,7 +183,7 @@ int route_service_destroy(route_service_h service) route_preference_destroy(handle->route_preference); } - int ret = location_free(handle->object); + int ret = location_map_free(handle->object); if (ret != LOCATION_ERROR_NONE) { return _convert_error_code(ret, __FUNCTION__); } @@ -272,8 +272,7 @@ int route_service_find(route_service_h service, location_coords_s origin, locati calldata->callback = callback; calldata->data = user_data; - ret = - location_request_route(handle->object, &start, &end, waypoint, pref->preference, __LocationRouteCB, calldata, + ret = location_map_request_route(handle->object, &start, &end, waypoint, pref->preference, __LocationRouteCB, calldata, &reqid); if (ret != LOCATION_ERROR_NONE) { free(calldata); @@ -296,7 +295,7 @@ int route_service_cancel(route_service_h service, int request_id) route_service_s *handle = (route_service_s *) service; - ret = location_cancel_route_request(handle->object, request_id); + ret = location_map_cancel_route_request(handle->object, request_id); if (ret != LOCATION_ERROR_NONE) { return _convert_error_code(ret, __func__); -- 2.7.4