Add new testcases for ml-service.
Change-Id: I41c2ca4abc50ab75a7b1b9f1c720662253c046d6
Signed-off-by: gichan2-jang <gichan2.jang@samsung.com>
--- /dev/null
+{
+ "single" :
+ {
+ "key" : "test-single-imgclf"
+ },
+ "information" :
+ {
+ "threshold" : "0.5",
+ "description" : "Config file to run unittest for ml-extension."
+ }
+}
\ No newline at end of file
extern int utc_ml_tensors_data_set_tensor_data_p (void);
extern int utc_ml_tensors_data_set_tensor_data_n (void);
+extern int utc_ml_tensors_data_clone_p (void);
+extern int utc_ml_tensors_data_clone_n1 (void);
+extern int utc_ml_tensors_data_clone_n2 (void);
+
+extern int utc_ml_tensors_data_get_info_p (void);
+extern int utc_ml_tensors_data_get_info_n1 (void);
+extern int utc_ml_tensors_data_get_info_n2 (void);
+
extern int utc_ml_single_open_p (void);
extern int utc_ml_single_open_n (void);
extern int utc_ml_single_close_p (void);
extern int utc_ml_service_resource_get_n2 (void);
extern int utc_ml_service_resource_scenario_p1 (void);
+extern int utc_ml_service_new_p1 (void);
+extern int utc_ml_service_new_n1 (void);
+extern int utc_ml_service_new_n2 (void);
+extern int utc_ml_service_set_event_cb_p1 (void);
+
+extern int utc_ml_service_set_event_cb_n1 (void);
+extern int utc_ml_service_get_input_information_p1 (void);
+extern int utc_ml_service_get_input_information_n1 (void);
+extern int utc_ml_service_get_input_information_n2 (void);
+extern int utc_ml_service_get_output_information_p1 (void);
+
+extern int utc_ml_service_get_output_information_n1 (void);
+extern int utc_ml_service_get_output_information_n2 (void);
+extern int utc_ml_service_set_information_p1 (void);
+extern int utc_ml_service_set_information_n1 (void);
+extern int utc_ml_service_set_information_n2 (void);
+
+extern int utc_ml_service_set_information_n3 (void);
+extern int utc_ml_service_get_information_p1 (void);
+extern int utc_ml_service_get_information_n1 (void);
+extern int utc_ml_service_get_information_n2 (void);
+extern int utc_ml_service_get_information_n3 (void);
+extern int utc_ml_service_request_p1 (void);
+
+extern int utc_ml_service_request_n1 (void);
+extern int utc_ml_service_request_n2 (void);
+
testcase tc_array[] = {
{"utc_ml_pipeline_construct_p", utc_ml_pipeline_construct_p, utc_nnstreamer_pipeline_startup, utc_nnstreamer_pipeline_cleanup},
{"utc_ml_pipeline_construct_n", utc_ml_pipeline_construct_n, utc_nnstreamer_pipeline_startup, utc_nnstreamer_pipeline_cleanup},
{"utc_ml_tensors_data_set_tensor_data_p", utc_ml_tensors_data_set_tensor_data_p, utc_nnstreamer_pipeline_tensor_data_startup, utc_nnstreamer_pipeline_tensor_data_cleanup},
{"utc_ml_tensors_data_set_tensor_data_n", utc_ml_tensors_data_set_tensor_data_n, utc_nnstreamer_pipeline_tensor_data_startup, utc_nnstreamer_pipeline_tensor_data_cleanup},
+ {"utc_ml_tensors_data_clone_p", utc_ml_tensors_data_clone_p, utc_nnstreamer_pipeline_tensor_data_startup, utc_nnstreamer_pipeline_tensor_data_cleanup},
+ {"utc_ml_tensors_data_clone_n1", utc_ml_tensors_data_clone_n1, utc_nnstreamer_pipeline_tensor_data_startup, utc_nnstreamer_pipeline_tensor_data_cleanup},
+ {"utc_ml_tensors_data_clone_n2", utc_ml_tensors_data_clone_n2, utc_nnstreamer_pipeline_tensor_data_startup, utc_nnstreamer_pipeline_tensor_data_cleanup},
+
+ {"utc_ml_tensors_data_get_info_p", utc_ml_tensors_data_get_info_p, utc_nnstreamer_pipeline_tensor_data_startup, utc_nnstreamer_pipeline_tensor_data_cleanup},
+ {"utc_ml_tensors_data_get_info_n1", utc_ml_tensors_data_get_info_n1, utc_nnstreamer_pipeline_tensor_data_startup, utc_nnstreamer_pipeline_tensor_data_cleanup},
+ {"utc_ml_tensors_data_get_info_n2", utc_ml_tensors_data_get_info_n2, utc_nnstreamer_pipeline_tensor_data_startup, utc_nnstreamer_pipeline_tensor_data_cleanup},
+
{"utc_ml_single_open_p", utc_ml_single_open_p, utc_nnstreamer_single_startup, utc_nnstreamer_single_cleanup},
{"utc_ml_single_open_n", utc_ml_single_open_n, utc_nnstreamer_single_startup, utc_nnstreamer_single_cleanup},
{"utc_ml_single_close_p", utc_ml_single_close_p, utc_nnstreamer_single_startup, utc_nnstreamer_single_cleanup},
{"utc_ml_service_resource_get_n2", utc_ml_service_resource_get_n2, utc_machine_learning_service_startup, utc_machine_learning_service_cleanup},
{"utc_ml_service_resource_scenario_p1", utc_ml_service_resource_scenario_p1, utc_machine_learning_service_startup, utc_machine_learning_service_cleanup},
+ {"utc_ml_service_new_p1", utc_ml_service_new_p1, utc_machine_learning_service_startup, utc_machine_learning_service_cleanup},
+ {"utc_ml_service_new_n1", utc_ml_service_new_n1, utc_machine_learning_service_startup, utc_machine_learning_service_cleanup},
+ {"utc_ml_service_new_n2", utc_ml_service_new_n2, utc_machine_learning_service_startup, utc_machine_learning_service_cleanup},
+ {"utc_ml_service_set_event_cb_p1", utc_ml_service_set_event_cb_p1, utc_machine_learning_service_startup, utc_machine_learning_service_cleanup},
+
+ {"utc_ml_service_set_event_cb_n1", utc_ml_service_set_event_cb_n1, utc_machine_learning_service_startup, utc_machine_learning_service_cleanup},
+ {"utc_ml_service_get_input_information_p1", utc_ml_service_get_input_information_p1, utc_machine_learning_service_startup, utc_machine_learning_service_cleanup},
+ {"utc_ml_service_get_input_information_n1", utc_ml_service_get_input_information_n1, utc_machine_learning_service_startup, utc_machine_learning_service_cleanup},
+ {"utc_ml_service_get_input_information_n2", utc_ml_service_get_input_information_n2, utc_machine_learning_service_startup, utc_machine_learning_service_cleanup},
+ {"utc_ml_service_get_output_information_p1", utc_ml_service_get_output_information_p1, utc_machine_learning_service_startup, utc_machine_learning_service_cleanup},
+
+ {"utc_ml_service_get_output_information_n1", utc_ml_service_get_output_information_n1, utc_machine_learning_service_startup, utc_machine_learning_service_cleanup},
+ {"utc_ml_service_get_output_information_n2", utc_ml_service_get_output_information_n2, utc_machine_learning_service_startup, utc_machine_learning_service_cleanup},
+ {"utc_ml_service_set_information_p1", utc_ml_service_set_information_p1, utc_machine_learning_service_startup, utc_machine_learning_service_cleanup},
+ {"utc_ml_service_set_information_n1", utc_ml_service_set_information_n1, utc_machine_learning_service_startup, utc_machine_learning_service_cleanup},
+ {"utc_ml_service_set_information_n2", utc_ml_service_set_information_n2, utc_machine_learning_service_startup, utc_machine_learning_service_cleanup},
+
+ {"utc_ml_service_set_information_n3", utc_ml_service_set_information_n3, utc_machine_learning_service_startup, utc_machine_learning_service_cleanup},
+ {"utc_ml_service_get_information_p1", utc_ml_service_get_information_p1, utc_machine_learning_service_startup, utc_machine_learning_service_cleanup},
+ {"utc_ml_service_get_information_n1", utc_ml_service_get_information_n1, utc_machine_learning_service_startup, utc_machine_learning_service_cleanup},
+ {"utc_ml_service_get_information_n2", utc_ml_service_get_information_n2, utc_machine_learning_service_startup, utc_machine_learning_service_cleanup},
+ {"utc_ml_service_get_information_n3", utc_ml_service_get_information_n3, utc_machine_learning_service_startup, utc_machine_learning_service_cleanup},
+ {"utc_ml_service_request_p1", utc_ml_service_request_p1, utc_machine_learning_service_startup, utc_machine_learning_service_cleanup},
+
+ {"utc_ml_service_request_n1", utc_ml_service_request_n1, utc_machine_learning_service_startup, utc_machine_learning_service_cleanup},
+ {"utc_ml_service_request_n2", utc_ml_service_request_n2, utc_machine_learning_service_startup, utc_machine_learning_service_cleanup},
+
{NULL, NULL}
};
extern int utc_ml_tensors_data_set_tensor_data_p (void);
extern int utc_ml_tensors_data_set_tensor_data_n (void);
+extern int utc_ml_tensors_data_clone_p (void);
+extern int utc_ml_tensors_data_clone_n1 (void);
+extern int utc_ml_tensors_data_clone_n2 (void);
+
+extern int utc_ml_tensors_data_get_info_p (void);
+extern int utc_ml_tensors_data_get_info_n1 (void);
+extern int utc_ml_tensors_data_get_info_n2 (void);
+
extern int utc_ml_single_open_p (void);
extern int utc_ml_single_open_n (void);
extern int utc_ml_single_close_p (void);
extern int utc_ml_service_resource_get_n2 (void);
extern int utc_ml_service_resource_scenario_p1 (void);
+extern int utc_ml_service_new_p1 (void);
+extern int utc_ml_service_new_n1 (void);
+extern int utc_ml_service_new_n2 (void);
+extern int utc_ml_service_set_event_cb_p1 (void);
+
+extern int utc_ml_service_set_event_cb_n1 (void);
+extern int utc_ml_service_get_input_information_p1 (void);
+extern int utc_ml_service_get_input_information_n1 (void);
+extern int utc_ml_service_get_input_information_n2 (void);
+extern int utc_ml_service_get_output_information_p1 (void);
+
+extern int utc_ml_service_get_output_information_n1 (void);
+extern int utc_ml_service_get_output_information_n2 (void);
+extern int utc_ml_service_set_information_p1 (void);
+extern int utc_ml_service_set_information_n1 (void);
+extern int utc_ml_service_set_information_n2 (void);
+
+extern int utc_ml_service_set_information_n3 (void);
+extern int utc_ml_service_get_information_p1 (void);
+extern int utc_ml_service_get_information_n1 (void);
+extern int utc_ml_service_get_information_n2 (void);
+extern int utc_ml_service_get_information_n3 (void);
+extern int utc_ml_service_request_p1 (void);
+
+extern int utc_ml_service_request_n1 (void);
+extern int utc_ml_service_request_n2 (void);
+
testcase tc_array[] = {
{"utc_ml_pipeline_construct_p", utc_ml_pipeline_construct_p, utc_nnstreamer_pipeline_startup, utc_nnstreamer_pipeline_cleanup},
{"utc_ml_pipeline_construct_n", utc_ml_pipeline_construct_n, utc_nnstreamer_pipeline_startup, utc_nnstreamer_pipeline_cleanup},
{"utc_ml_tensors_data_set_tensor_data_p", utc_ml_tensors_data_set_tensor_data_p, utc_nnstreamer_pipeline_tensor_data_startup, utc_nnstreamer_pipeline_tensor_data_cleanup},
{"utc_ml_tensors_data_set_tensor_data_n", utc_ml_tensors_data_set_tensor_data_n, utc_nnstreamer_pipeline_tensor_data_startup, utc_nnstreamer_pipeline_tensor_data_cleanup},
+ {"utc_ml_tensors_data_clone_p", utc_ml_tensors_data_clone_p, utc_nnstreamer_pipeline_tensor_data_startup, utc_nnstreamer_pipeline_tensor_data_cleanup},
+ {"utc_ml_tensors_data_clone_n1", utc_ml_tensors_data_clone_n1, utc_nnstreamer_pipeline_tensor_data_startup, utc_nnstreamer_pipeline_tensor_data_cleanup},
+ {"utc_ml_tensors_data_clone_n2", utc_ml_tensors_data_clone_n2, utc_nnstreamer_pipeline_tensor_data_startup, utc_nnstreamer_pipeline_tensor_data_cleanup},
+
+ {"utc_ml_tensors_data_get_info_p", utc_ml_tensors_data_get_info_p, utc_nnstreamer_pipeline_tensor_data_startup, utc_nnstreamer_pipeline_tensor_data_cleanup},
+ {"utc_ml_tensors_data_get_info_n1", utc_ml_tensors_data_get_info_n1, utc_nnstreamer_pipeline_tensor_data_startup, utc_nnstreamer_pipeline_tensor_data_cleanup},
+ {"utc_ml_tensors_data_get_info_n2", utc_ml_tensors_data_get_info_n2, utc_nnstreamer_pipeline_tensor_data_startup, utc_nnstreamer_pipeline_tensor_data_cleanup},
+
{"utc_ml_single_open_p", utc_ml_single_open_p, utc_nnstreamer_single_startup, utc_nnstreamer_single_cleanup},
{"utc_ml_single_open_n", utc_ml_single_open_n, utc_nnstreamer_single_startup, utc_nnstreamer_single_cleanup},
{"utc_ml_single_close_p", utc_ml_single_close_p, utc_nnstreamer_single_startup, utc_nnstreamer_single_cleanup},
{"utc_ml_service_resource_get_n2", utc_ml_service_resource_get_n2, utc_machine_learning_service_startup, utc_machine_learning_service_cleanup},
{"utc_ml_service_resource_scenario_p1", utc_ml_service_resource_scenario_p1, utc_machine_learning_service_startup, utc_machine_learning_service_cleanup},
+ {"utc_ml_service_new_p1", utc_ml_service_new_p1, utc_machine_learning_service_startup, utc_machine_learning_service_cleanup},
+ {"utc_ml_service_new_n1", utc_ml_service_new_n1, utc_machine_learning_service_startup, utc_machine_learning_service_cleanup},
+ {"utc_ml_service_new_n2", utc_ml_service_new_n2, utc_machine_learning_service_startup, utc_machine_learning_service_cleanup},
+ {"utc_ml_service_set_event_cb_p1", utc_ml_service_set_event_cb_p1, utc_machine_learning_service_startup, utc_machine_learning_service_cleanup},
+
+ {"utc_ml_service_set_event_cb_n1", utc_ml_service_set_event_cb_n1, utc_machine_learning_service_startup, utc_machine_learning_service_cleanup},
+ {"utc_ml_service_get_input_information_p1", utc_ml_service_get_input_information_p1, utc_machine_learning_service_startup, utc_machine_learning_service_cleanup},
+ {"utc_ml_service_get_input_information_n1", utc_ml_service_get_input_information_n1, utc_machine_learning_service_startup, utc_machine_learning_service_cleanup},
+ {"utc_ml_service_get_input_information_n2", utc_ml_service_get_input_information_n2, utc_machine_learning_service_startup, utc_machine_learning_service_cleanup},
+ {"utc_ml_service_get_output_information_p1", utc_ml_service_get_output_information_p1, utc_machine_learning_service_startup, utc_machine_learning_service_cleanup},
+
+ {"utc_ml_service_get_output_information_n1", utc_ml_service_get_output_information_n1, utc_machine_learning_service_startup, utc_machine_learning_service_cleanup},
+ {"utc_ml_service_get_output_information_n2", utc_ml_service_get_output_information_n2, utc_machine_learning_service_startup, utc_machine_learning_service_cleanup},
+ {"utc_ml_service_set_information_p1", utc_ml_service_set_information_p1, utc_machine_learning_service_startup, utc_machine_learning_service_cleanup},
+ {"utc_ml_service_set_information_n1", utc_ml_service_set_information_n1, utc_machine_learning_service_startup, utc_machine_learning_service_cleanup},
+ {"utc_ml_service_set_information_n2", utc_ml_service_set_information_n2, utc_machine_learning_service_startup, utc_machine_learning_service_cleanup},
+
+ {"utc_ml_service_set_information_n3", utc_ml_service_set_information_n3, utc_machine_learning_service_startup, utc_machine_learning_service_cleanup},
+ {"utc_ml_service_get_information_p1", utc_ml_service_get_information_p1, utc_machine_learning_service_startup, utc_machine_learning_service_cleanup},
+ {"utc_ml_service_get_information_n1", utc_ml_service_get_information_n1, utc_machine_learning_service_startup, utc_machine_learning_service_cleanup},
+ {"utc_ml_service_get_information_n2", utc_ml_service_get_information_n2, utc_machine_learning_service_startup, utc_machine_learning_service_cleanup},
+ {"utc_ml_service_get_information_n3", utc_ml_service_get_information_n3, utc_machine_learning_service_startup, utc_machine_learning_service_cleanup},
+ {"utc_ml_service_request_p1", utc_ml_service_request_p1, utc_machine_learning_service_startup, utc_machine_learning_service_cleanup},
+
+ {"utc_ml_service_request_n1", utc_ml_service_request_n1, utc_machine_learning_service_startup, utc_machine_learning_service_cleanup},
+ {"utc_ml_service_request_n2", utc_ml_service_request_n2, utc_machine_learning_service_startup, utc_machine_learning_service_cleanup},
+
{NULL, NULL}
};
extern int utc_ml_tensors_data_set_tensor_data_p (void);
extern int utc_ml_tensors_data_set_tensor_data_n (void);
+extern int utc_ml_tensors_data_clone_p (void);
+extern int utc_ml_tensors_data_clone_n1 (void);
+extern int utc_ml_tensors_data_clone_n2 (void);
+
+extern int utc_ml_tensors_data_get_info_p (void);
+extern int utc_ml_tensors_data_get_info_n1 (void);
+extern int utc_ml_tensors_data_get_info_n2 (void);
+
extern int utc_ml_single_open_p (void);
extern int utc_ml_single_open_n (void);
extern int utc_ml_single_close_p (void);
{"utc_ml_tensors_data_set_tensor_data_p", utc_ml_tensors_data_set_tensor_data_p, utc_nnstreamer_pipeline_tensor_data_startup, utc_nnstreamer_pipeline_tensor_data_cleanup},
{"utc_ml_tensors_data_set_tensor_data_n", utc_ml_tensors_data_set_tensor_data_n, utc_nnstreamer_pipeline_tensor_data_startup, utc_nnstreamer_pipeline_tensor_data_cleanup},
+ {"utc_ml_tensors_data_clone_p", utc_ml_tensors_data_clone_p, utc_nnstreamer_pipeline_tensor_data_startup, utc_nnstreamer_pipeline_tensor_data_cleanup},
+ {"utc_ml_tensors_data_clone_n1", utc_ml_tensors_data_clone_n1, utc_nnstreamer_pipeline_tensor_data_startup, utc_nnstreamer_pipeline_tensor_data_cleanup},
+ {"utc_ml_tensors_data_clone_n2", utc_ml_tensors_data_clone_n2, utc_nnstreamer_pipeline_tensor_data_startup, utc_nnstreamer_pipeline_tensor_data_cleanup},
+
+ {"utc_ml_tensors_data_get_info_p", utc_ml_tensors_data_get_info_p, utc_nnstreamer_pipeline_tensor_data_startup, utc_nnstreamer_pipeline_tensor_data_cleanup},
+ {"utc_ml_tensors_data_get_info_n1", utc_ml_tensors_data_get_info_n1, utc_nnstreamer_pipeline_tensor_data_startup, utc_nnstreamer_pipeline_tensor_data_cleanup},
+ {"utc_ml_tensors_data_get_info_n2", utc_ml_tensors_data_get_info_n2, utc_nnstreamer_pipeline_tensor_data_startup, utc_nnstreamer_pipeline_tensor_data_cleanup},
+
+
{"utc_ml_single_open_p", utc_ml_single_open_p, utc_nnstreamer_single_startup, utc_nnstreamer_single_cleanup},
{"utc_ml_single_open_n", utc_ml_single_open_n, utc_nnstreamer_single_startup, utc_nnstreamer_single_cleanup},
{"utc_ml_single_close_p", utc_ml_single_close_p, utc_nnstreamer_single_startup, utc_nnstreamer_single_cleanup},
extern int utc_ml_tensors_data_set_tensor_data_p (void);
extern int utc_ml_tensors_data_set_tensor_data_n (void);
+extern int utc_ml_tensors_data_clone_p (void);
+extern int utc_ml_tensors_data_clone_n1 (void);
+extern int utc_ml_tensors_data_clone_n2 (void);
+
+extern int utc_ml_tensors_data_get_info_p (void);
+extern int utc_ml_tensors_data_get_info_n1 (void);
+extern int utc_ml_tensors_data_get_info_n2 (void);
+
extern int utc_ml_single_open_p (void);
extern int utc_ml_single_open_n (void);
extern int utc_ml_single_close_p (void);
extern int utc_ml_service_resource_get_n2 (void);
extern int utc_ml_service_resource_scenario_p1 (void);
+extern int utc_ml_service_new_p1 (void);
+extern int utc_ml_service_new_n1 (void);
+extern int utc_ml_service_new_n2 (void);
+extern int utc_ml_service_set_event_cb_p1 (void);
+
+extern int utc_ml_service_set_event_cb_n1 (void);
+extern int utc_ml_service_get_input_information_p1 (void);
+extern int utc_ml_service_get_input_information_n1 (void);
+extern int utc_ml_service_get_input_information_n2 (void);
+extern int utc_ml_service_get_output_information_p1 (void);
+
+extern int utc_ml_service_get_output_information_n1 (void);
+extern int utc_ml_service_get_output_information_n2 (void);
+extern int utc_ml_service_set_information_p1 (void);
+extern int utc_ml_service_set_information_n1 (void);
+extern int utc_ml_service_set_information_n2 (void);
+
+extern int utc_ml_service_set_information_n3 (void);
+extern int utc_ml_service_get_information_p1 (void);
+extern int utc_ml_service_get_information_n1 (void);
+extern int utc_ml_service_get_information_n2 (void);
+extern int utc_ml_service_get_information_n3 (void);
+extern int utc_ml_service_request_p1 (void);
+
+extern int utc_ml_service_request_n1 (void);
+extern int utc_ml_service_request_n2 (void);
+
testcase tc_array[] = {
{"utc_ml_pipeline_construct_p", utc_ml_pipeline_construct_p, utc_nnstreamer_pipeline_startup, utc_nnstreamer_pipeline_cleanup},
{"utc_ml_pipeline_construct_n", utc_ml_pipeline_construct_n, utc_nnstreamer_pipeline_startup, utc_nnstreamer_pipeline_cleanup},
{"utc_ml_tensors_data_set_tensor_data_p", utc_ml_tensors_data_set_tensor_data_p, utc_nnstreamer_pipeline_tensor_data_startup, utc_nnstreamer_pipeline_tensor_data_cleanup},
{"utc_ml_tensors_data_set_tensor_data_n", utc_ml_tensors_data_set_tensor_data_n, utc_nnstreamer_pipeline_tensor_data_startup, utc_nnstreamer_pipeline_tensor_data_cleanup},
+ {"utc_ml_tensors_data_clone_p", utc_ml_tensors_data_clone_p, utc_nnstreamer_pipeline_tensor_data_startup, utc_nnstreamer_pipeline_tensor_data_cleanup},
+ {"utc_ml_tensors_data_clone_n1", utc_ml_tensors_data_clone_n1, utc_nnstreamer_pipeline_tensor_data_startup, utc_nnstreamer_pipeline_tensor_data_cleanup},
+ {"utc_ml_tensors_data_clone_n2", utc_ml_tensors_data_clone_n2, utc_nnstreamer_pipeline_tensor_data_startup, utc_nnstreamer_pipeline_tensor_data_cleanup},
+
+ {"utc_ml_tensors_data_get_info_p", utc_ml_tensors_data_get_info_p, utc_nnstreamer_pipeline_tensor_data_startup, utc_nnstreamer_pipeline_tensor_data_cleanup},
+ {"utc_ml_tensors_data_get_info_n1", utc_ml_tensors_data_get_info_n1, utc_nnstreamer_pipeline_tensor_data_startup, utc_nnstreamer_pipeline_tensor_data_cleanup},
+ {"utc_ml_tensors_data_get_info_n2", utc_ml_tensors_data_get_info_n2, utc_nnstreamer_pipeline_tensor_data_startup, utc_nnstreamer_pipeline_tensor_data_cleanup},
+
{"utc_ml_single_open_p", utc_ml_single_open_p, utc_nnstreamer_single_startup, utc_nnstreamer_single_cleanup},
{"utc_ml_single_open_n", utc_ml_single_open_n, utc_nnstreamer_single_startup, utc_nnstreamer_single_cleanup},
{"utc_ml_single_close_p", utc_ml_single_close_p, utc_nnstreamer_single_startup, utc_nnstreamer_single_cleanup},
{"utc_ml_service_resource_get_n2", utc_ml_service_resource_get_n2, utc_machine_learning_service_startup, utc_machine_learning_service_cleanup},
{"utc_ml_service_resource_scenario_p1", utc_ml_service_resource_scenario_p1, utc_machine_learning_service_startup, utc_machine_learning_service_cleanup},
+ {"utc_ml_service_new_p1", utc_ml_service_new_p1, utc_machine_learning_service_startup, utc_machine_learning_service_cleanup},
+ {"utc_ml_service_new_n1", utc_ml_service_new_n1, utc_machine_learning_service_startup, utc_machine_learning_service_cleanup},
+ {"utc_ml_service_new_n2", utc_ml_service_new_n2, utc_machine_learning_service_startup, utc_machine_learning_service_cleanup},
+ {"utc_ml_service_set_event_cb_p1", utc_ml_service_set_event_cb_p1, utc_machine_learning_service_startup, utc_machine_learning_service_cleanup},
+
+ {"utc_ml_service_set_event_cb_n1", utc_ml_service_set_event_cb_n1, utc_machine_learning_service_startup, utc_machine_learning_service_cleanup},
+ {"utc_ml_service_get_input_information_p1", utc_ml_service_get_input_information_p1, utc_machine_learning_service_startup, utc_machine_learning_service_cleanup},
+ {"utc_ml_service_get_input_information_n1", utc_ml_service_get_input_information_n1, utc_machine_learning_service_startup, utc_machine_learning_service_cleanup},
+ {"utc_ml_service_get_input_information_n2", utc_ml_service_get_input_information_n2, utc_machine_learning_service_startup, utc_machine_learning_service_cleanup},
+ {"utc_ml_service_get_output_information_p1", utc_ml_service_get_output_information_p1, utc_machine_learning_service_startup, utc_machine_learning_service_cleanup},
+
+ {"utc_ml_service_get_output_information_n1", utc_ml_service_get_output_information_n1, utc_machine_learning_service_startup, utc_machine_learning_service_cleanup},
+ {"utc_ml_service_get_output_information_n2", utc_ml_service_get_output_information_n2, utc_machine_learning_service_startup, utc_machine_learning_service_cleanup},
+ {"utc_ml_service_set_information_p1", utc_ml_service_set_information_p1, utc_machine_learning_service_startup, utc_machine_learning_service_cleanup},
+ {"utc_ml_service_set_information_n1", utc_ml_service_set_information_n1, utc_machine_learning_service_startup, utc_machine_learning_service_cleanup},
+ {"utc_ml_service_set_information_n2", utc_ml_service_set_information_n2, utc_machine_learning_service_startup, utc_machine_learning_service_cleanup},
+
+ {"utc_ml_service_set_information_n3", utc_ml_service_set_information_n3, utc_machine_learning_service_startup, utc_machine_learning_service_cleanup},
+ {"utc_ml_service_get_information_p1", utc_ml_service_get_information_p1, utc_machine_learning_service_startup, utc_machine_learning_service_cleanup},
+ {"utc_ml_service_get_information_n1", utc_ml_service_get_information_n1, utc_machine_learning_service_startup, utc_machine_learning_service_cleanup},
+ {"utc_ml_service_get_information_n2", utc_ml_service_get_information_n2, utc_machine_learning_service_startup, utc_machine_learning_service_cleanup},
+ {"utc_ml_service_get_information_n3", utc_ml_service_get_information_n3, utc_machine_learning_service_startup, utc_machine_learning_service_cleanup},
+ {"utc_ml_service_request_p1", utc_ml_service_request_p1, utc_machine_learning_service_startup, utc_machine_learning_service_cleanup},
+
+ {"utc_ml_service_request_n1", utc_ml_service_request_n1, utc_machine_learning_service_startup, utc_machine_learning_service_cleanup},
+ {"utc_ml_service_request_n2", utc_ml_service_request_n2, utc_machine_learning_service_startup, utc_machine_learning_service_cleanup},
+
{NULL, NULL}
};
static gchar *test_model;
static gchar *test_model_add;
static gchar *pipeline;
+static gchar *config_path;
/**
* @brief Get available port number.
{
const gchar *model_file = "mobilenet_v1_1.0_224_quant.tflite";
const gchar *model_file_add = "add.tflite";
+ const gchar *config_file = "config_single_imgclf_key.conf";
int ret = system_info_get_platform_bool(FEATURE_ML, &feature_ml);
if (ret != SYSTEM_INFO_ERROR_NONE || !feature_ml) {
if ( true == GetValueForTCTSetting("DEVICE_SUITE_TARGET_30", pszValue, API_NAMESPACE ))
{
- int model_path_len = strlen(pszValue) + strlen(model_file) + 10;
- test_model = (gchar*)malloc(model_path_len);
- snprintf(test_model, model_path_len, "%s/res/res/%s", pszValue, model_file);
+ int path_len = strlen(pszValue) + strlen(model_file) + 10;
+ test_model = (gchar*)malloc(path_len);
+ snprintf(test_model, path_len, "%s/res/res/%s", pszValue, model_file);
FPRINTF("[%s][%d][%s] %s\\n", __FILE__, __LINE__, __FUNCTION__, test_model);
- model_path_len = strlen(pszValue) + strlen(model_file_add) + 10;
- test_model_add = (gchar*)malloc(model_path_len);
- snprintf(test_model_add, model_path_len, "%s/res/res/%s", pszValue, model_file_add);
+ path_len = strlen(pszValue) + strlen(model_file_add) + 10;
+ test_model_add = (gchar*)malloc(path_len);
+ snprintf(test_model_add, path_len, "%s/res/res/%s", pszValue, model_file_add);
FPRINTF("[%s][%d][%s] %s\\n", __FILE__, __LINE__, __FUNCTION__, test_model_add);
+
+ path_len = strlen(pszValue) + strlen(config_file) + 10;
+ config_path = (gchar*)malloc(path_len);
+ snprintf(config_path, path_len, "%s/res/res/%s", pszValue, config_file);
+ FPRINTF("[%s][%d][%s] %s\\n", __FILE__, __LINE__, __FUNCTION__, config_path);
}
else
{
g_free (pipeline);
g_free (test_model);
g_free (test_model_add);
+ g_free (config_path);
}
/**
return 0;
}
+
+/**
+ * @testcase utc_ml_service_new_p1
+ * @since_tizen 9.0
+ * @description Positive test case to crete machine learing service handle.
+ */
+int utc_ml_service_new_p1 (void)
+{
+ IS_SUPPORT_ML_SERVICE_FEATURE;
+ ml_service_h handle = NULL;
+ guint version;
+ const gchar *test_name = "test-single-imgclf";
+
+ /* Clear registered model and don't care the result */
+ status = ml_service_model_delete (test_name, 0U);
+ assert (status == ML_ERROR_NONE || status == ML_ERROR_INVALID_PARAMETER);
+
+ status = ml_service_model_register (test_name, test_model, true, NULL, &version);
+ assert_eq (ML_ERROR_NONE, status);
+
+ /* Test */
+ status = ml_service_new (config_path, &handle);
+ assert_eq (ML_ERROR_NONE, status);
+ assert (NULL != handle);
+
+ status = ml_service_destroy (handle);
+ assert_eq (ML_ERROR_NONE, status);
+ status = ml_service_model_delete (test_name, 0U);
+ assert_eq (ML_ERROR_NONE, status);
+
+ return 0;
+}
+
+/**
+ * @testcase utc_ml_service_new_n1
+ * @since_tizen 9.0
+ * @description Negative test case to crete machine learing service handle with invalid param.
+ */
+int utc_ml_service_new_n1 (void)
+{
+ IS_SUPPORT_ML_SERVICE_FEATURE;
+ ml_service_h handle = NULL;
+
+ /* Test */
+ status = ml_service_new (NULL, &handle);
+ assert_eq (ML_ERROR_INVALID_PARAMETER, status);
+ assert (NULL == handle);
+
+ return 0;
+}
+
+/**
+ * @testcase utc_ml_service_new_n2
+ * @since_tizen 9.0
+ * @description Negative test case to crete machine learing service handle with invalid param.
+ */
+int utc_ml_service_new_n2 (void)
+{
+ IS_SUPPORT_ML_SERVICE_FEATURE;
+
+ /* Test */
+ status = ml_service_new (config_path, NULL);
+ assert_eq (ML_ERROR_INVALID_PARAMETER, status);
+
+ return 0;
+}
+
+/**
+ * @function _ml_service_test_imgclf_cb
+ * @description Event callback for machine learning service.
+ */
+static void
+_ml_service_test_imgclf_cb (ml_service_event_e event, ml_information_h event_data, void *user_data)
+{
+ guint *received = (guint *) user_data;
+
+ switch (event) {
+ case ML_SERVICE_EVENT_NEW_DATA:
+ assert_neq_no_return (NULL, event_data);
+ (*received)++;
+ break;
+ default:
+ break;
+ }
+}
+
+/**
+ * @testcase utc_ml_service_set_event_cb_p1
+ * @since_tizen 9.0
+ * @description Positive test case to set ml-service event callback.
+ */
+int utc_ml_service_set_event_cb_p1 (void)
+{
+ IS_SUPPORT_ML_SERVICE_FEATURE;
+ ml_service_h handle = NULL;
+ guint version;
+ const gchar *test_name = "test-single-imgclf";
+
+ /* Clear registered model and don't care the result */
+ status = ml_service_model_delete (test_name, 0U);
+ assert (status == ML_ERROR_NONE || status == ML_ERROR_INVALID_PARAMETER);
+
+ status = ml_service_model_register (test_name, test_model, true, NULL, &version);
+ assert_eq (ML_ERROR_NONE, status);
+
+ status = ml_service_new (config_path, &handle);
+ assert_eq (ML_ERROR_NONE, status);
+ assert (NULL != handle);
+
+ /* Test */
+ status = ml_service_set_event_cb (handle, _ml_service_test_imgclf_cb, NULL);
+ assert_eq (ML_ERROR_NONE, status);
+
+ status = ml_service_destroy (handle);
+ assert_eq (ML_ERROR_NONE, status);
+
+ status = ml_service_model_delete (test_name, 0U);
+ assert_eq (ML_ERROR_NONE, status);
+
+ return 0;
+}
+
+/**
+ * @testcase utc_ml_service_set_event_cb_n1
+ * @since_tizen 9.0
+ * @description Negative test case to destroy machine learing service handle with invalid param.
+ */
+int utc_ml_service_set_event_cb_n1 (void)
+{
+ IS_SUPPORT_ML_SERVICE_FEATURE;
+
+ /* Test */
+ status = ml_service_set_event_cb (NULL, _ml_service_test_imgclf_cb, NULL);
+ assert_eq (ML_ERROR_INVALID_PARAMETER, status);
+
+ return 0;
+}
+
+/**
+ * @testcase utc_ml_service_get_input_information_p1
+ * @since_tizen 9.0
+ * @description Positive test case to get input information.
+ */
+int utc_ml_service_get_input_information_p1 (void)
+{
+ IS_SUPPORT_ML_SERVICE_FEATURE;
+ ml_service_h handle = NULL;
+ ml_tensors_info_h info;
+ guint count = 0;
+ ml_tensor_type_e type;
+ ml_tensor_dimension in_dim = { 0 };
+ guint version;
+ const gchar *test_name = "test-single-imgclf";
+
+ /* Clear registered model and don't care the result */
+ status = ml_service_model_delete (test_name, 0U);
+ assert (status == ML_ERROR_NONE || status == ML_ERROR_INVALID_PARAMETER);
+
+ status = ml_service_model_register (test_name, test_model, true, NULL, &version);
+ assert_eq (ML_ERROR_NONE, status);
+
+ status = ml_service_new (config_path, &handle);
+ assert_eq (ML_ERROR_NONE, status);
+ assert (NULL != handle);
+
+ /* Test */
+ status = ml_service_get_input_information (handle, NULL, &info);
+ assert_eq (ML_ERROR_NONE, status);
+
+ status = ml_tensors_info_get_count (info, &count);
+ assert_eq (ML_ERROR_NONE, status);
+ assert_eq (1U, count);
+
+ type = ML_TENSOR_TYPE_UNKNOWN;
+ status = ml_tensors_info_get_tensor_type (info, 0, &type);
+ assert_eq (ML_ERROR_NONE, status);
+ assert_eq (ML_TENSOR_TYPE_UINT8, type);
+
+ status = ml_tensors_info_get_tensor_dimension (info, 0, in_dim);
+ assert_eq (ML_ERROR_NONE, status);
+ assert_eq (3U, in_dim[0]);
+ assert_eq (224U, in_dim[1]);
+ assert_eq (224U, in_dim[2]);
+ assert_eq (1U, in_dim[3]);
+
+ status = ml_tensors_info_destroy (info);
+ assert_eq (ML_ERROR_NONE, status);
+ status = ml_service_destroy (handle);
+ assert_eq (ML_ERROR_NONE, status);
+
+ status = ml_service_model_delete (test_name, 0U);
+ assert_eq (ML_ERROR_NONE, status);
+
+ return 0;
+}
+
+/**
+ * @testcase utc_ml_service_get_input_information_n1
+ * @since_tizen 9.0
+ * @description Negative test case to get input information with invalid param.
+ */
+int utc_ml_service_get_input_information_n1 (void)
+{
+ IS_SUPPORT_ML_SERVICE_FEATURE;
+ ml_tensors_info_h info;
+
+ /* Test */
+ status = ml_service_get_input_information (NULL, NULL, &info);
+ assert_eq (ML_ERROR_INVALID_PARAMETER, status);
+
+ return 0;
+}
+
+/**
+ * @testcase utc_ml_service_get_input_information_n2
+ * @since_tizen 9.0
+ * @description Negative test case to get input information with invalid param.
+ */
+int utc_ml_service_get_input_information_n2 (void)
+{
+ IS_SUPPORT_ML_SERVICE_FEATURE;
+ ml_service_h handle = NULL;
+ guint version;
+ const gchar *test_name = "test-single-imgclf";
+
+ /* Clear registered model and don't care the result */
+ status = ml_service_model_delete (test_name, 0U);
+ assert (status == ML_ERROR_NONE || status == ML_ERROR_INVALID_PARAMETER);
+
+ status = ml_service_model_register (test_name, test_model, true, NULL, &version);
+ assert_eq (ML_ERROR_NONE, status);
+
+ status = ml_service_new (config_path, &handle);
+ assert_eq (ML_ERROR_NONE, status);
+ assert (NULL != handle);
+
+ /* Test */
+ status = ml_service_get_input_information (handle, NULL, NULL);
+ assert_eq (ML_ERROR_INVALID_PARAMETER, status);
+
+ status = ml_service_destroy (handle);
+ assert_eq (ML_ERROR_NONE, status);
+
+ status = ml_service_model_delete (test_name, 0U);
+ assert_eq (ML_ERROR_NONE, status);
+
+ return 0;
+}
+
+/**
+ * @testcase utc_ml_service_get_output_information_p1
+ * @since_tizen 9.0
+ * @description Positive test case to get output information.
+ */
+int utc_ml_service_get_output_information_p1 (void)
+{
+ IS_SUPPORT_ML_SERVICE_FEATURE;
+ ml_service_h handle = NULL;
+ ml_tensors_info_h info;
+ guint count = 0;
+ ml_tensor_type_e type;
+ ml_tensor_dimension out_dim = { 0 };
+ guint version;
+ const gchar *test_name = "test-single-imgclf";
+
+ /* Clear registered model and don't care the result */
+ status = ml_service_model_delete (test_name, 0U);
+ assert (status == ML_ERROR_NONE || status == ML_ERROR_INVALID_PARAMETER);
+
+ status = ml_service_model_register (test_name, test_model, true, NULL, &version);
+ assert_eq (ML_ERROR_NONE, status);
+
+ status = ml_service_new (config_path, &handle);
+ assert_eq (ML_ERROR_NONE, status);
+ assert (NULL != handle);
+
+ /* Test */
+ status = ml_service_get_output_information (handle, NULL, &info);
+ assert_eq (ML_ERROR_NONE, status);
+
+ status = ml_tensors_info_get_count (info, &count);
+ assert_eq (ML_ERROR_NONE, status);
+ assert_eq (1U, count);
+
+ type = ML_TENSOR_TYPE_UNKNOWN;
+ status = ml_tensors_info_get_tensor_type (info, 0, &type);
+ assert_eq (ML_ERROR_NONE, status);
+ assert_eq (ML_TENSOR_TYPE_UINT8, type);
+
+ status = ml_tensors_info_get_tensor_dimension (info, 0, out_dim);
+ assert_eq (ML_ERROR_NONE, status);
+ assert_eq (1001U, out_dim[0]);
+ assert_eq (1U, out_dim[1]);
+
+ status = ml_tensors_info_destroy (info);
+ assert_eq (ML_ERROR_NONE, status);
+ status = ml_service_destroy (handle);
+ assert_eq (ML_ERROR_NONE, status);
+ status = ml_service_model_delete (test_name, 0U);
+ assert_eq (ML_ERROR_NONE, status);
+
+ return 0;
+}
+
+/**
+ * @testcase utc_ml_service_get_output_information_n1
+ * @since_tizen 9.0
+ * @description Negative test case to get output information with invalid param.
+ */
+int utc_ml_service_get_output_information_n1 (void)
+{
+ IS_SUPPORT_ML_SERVICE_FEATURE;
+ ml_tensors_info_h info;
+
+ /* Test */
+ status = ml_service_get_output_information (NULL, NULL, &info);
+ assert_eq (ML_ERROR_INVALID_PARAMETER, status);
+
+ return 0;
+}
+
+/**
+ * @testcase utc_ml_service_get_output_information_n2
+ * @since_tizen 9.0
+ * @description Negative test case to get output information with invalid param.
+ */
+int utc_ml_service_get_output_information_n2 (void)
+{
+ IS_SUPPORT_ML_SERVICE_FEATURE;
+ ml_service_h handle = NULL;
+ guint version;
+ const gchar *test_name = "test-single-imgclf";
+
+ /* Clear registered model and don't care the result */
+ status = ml_service_model_delete (test_name, 0U);
+ assert (status == ML_ERROR_NONE || status == ML_ERROR_INVALID_PARAMETER);
+
+ status = ml_service_model_register (test_name, test_model, true, NULL, &version);
+ assert_eq (ML_ERROR_NONE, status);
+
+ status = ml_service_new (config_path, &handle);
+ assert_eq (ML_ERROR_NONE, status);
+ assert (NULL != handle);
+
+ /* Test */
+ status = ml_service_get_output_information (handle, NULL, NULL);
+ assert_eq (ML_ERROR_INVALID_PARAMETER, status);
+
+ status = ml_service_destroy (handle);
+ assert_eq (ML_ERROR_NONE, status);
+ status = ml_service_model_delete (test_name, 0U);
+ assert_eq (ML_ERROR_NONE, status);
+
+ return 0;
+}
+
+/**
+ * @testcase utc_ml_service_set_information_p1
+ * @since_tizen 9.0
+ * @description Positive test case to set information.
+ */
+int utc_ml_service_set_information_p1 (void)
+{
+ IS_SUPPORT_ML_SERVICE_FEATURE;
+ ml_service_h handle = NULL;
+ guint version;
+ const gchar *test_name = "test-single-imgclf";
+
+ /* Clear registered model and don't care the result */
+ status = ml_service_model_delete (test_name, 0U);
+ assert (status == ML_ERROR_NONE || status == ML_ERROR_INVALID_PARAMETER);
+
+ status = ml_service_model_register (test_name, test_model, true, NULL, &version);
+ assert_eq (ML_ERROR_NONE, status);
+
+ status = ml_service_new (config_path, &handle);
+ assert_eq (ML_ERROR_NONE, status);
+ assert (NULL != handle);
+
+ /* Test */
+ status = ml_service_set_information (handle, "test-threshold", "0.1");
+ assert_eq (ML_ERROR_NONE, status);
+
+ status = ml_service_destroy (handle);
+ assert_eq (ML_ERROR_NONE, status);
+ status = ml_service_model_delete (test_name, 0U);
+ assert_eq (ML_ERROR_NONE, status);
+
+ return 0;
+}
+
+/**
+ * @testcase utc_ml_service_set_information_n1
+ * @since_tizen 9.0
+ * @description Negative test case to set information with invalid param.
+ */
+int utc_ml_service_set_information_n1 (void)
+{
+ IS_SUPPORT_ML_SERVICE_FEATURE;
+
+ /* Test */
+ status = ml_service_set_information (NULL, "test-threshold", "0.1");
+ assert_eq (ML_ERROR_INVALID_PARAMETER, status);
+
+ return 0;
+}
+
+/**
+ * @testcase utc_ml_service_set_information_n2
+ * @since_tizen 9.0
+ * @description Negative test case to set information with invalid param.
+ */
+int utc_ml_service_set_information_n2 (void)
+{
+ IS_SUPPORT_ML_SERVICE_FEATURE;
+ ml_service_h handle = NULL;
+ guint version;
+ const gchar *test_name = "test-single-imgclf";
+
+ /* Clear registered model and don't care the result */
+ status = ml_service_model_delete (test_name, 0U);
+ assert (status == ML_ERROR_NONE || status == ML_ERROR_INVALID_PARAMETER);
+
+ status = ml_service_model_register (test_name, test_model, true, NULL, &version);
+ assert_eq (ML_ERROR_NONE, status);
+
+ status = ml_service_new (config_path, &handle);
+ assert_eq (ML_ERROR_NONE, status);
+ assert (NULL != handle);
+
+ /* Test */
+ status = ml_service_set_information (handle, NULL, "0.1");
+ assert_eq (ML_ERROR_INVALID_PARAMETER, status);
+
+ status = ml_service_destroy (handle);
+ assert_eq (ML_ERROR_NONE, status);
+ status = ml_service_model_delete (test_name, 0U);
+ assert_eq (ML_ERROR_NONE, status);
+
+ return 0;
+}
+
+/**
+ * @testcase utc_ml_service_set_information_n3
+ * @since_tizen 9.0
+ * @description Negative test case to set information with invalid param.
+ */
+int utc_ml_service_set_information_n3 (void)
+{
+ IS_SUPPORT_ML_SERVICE_FEATURE;
+ ml_service_h handle = NULL;
+ guint version;
+ const gchar *test_name = "test-single-imgclf";
+
+ /* Clear registered model and don't care the result */
+ status = ml_service_model_delete (test_name, 0U);
+ assert (status == ML_ERROR_NONE || status == ML_ERROR_INVALID_PARAMETER);
+
+ status = ml_service_model_register (test_name, test_model, true, NULL, &version);
+ assert_eq (ML_ERROR_NONE, status);
+
+ status = ml_service_new (config_path, &handle);
+ assert_eq (ML_ERROR_NONE, status);
+ assert (NULL != handle);
+
+ /* Test */
+ status = ml_service_set_information (handle, "test-threshold", NULL);
+ assert_eq (ML_ERROR_INVALID_PARAMETER, status);
+
+ status = ml_service_destroy (handle);
+ assert_eq (ML_ERROR_NONE, status);
+ status = ml_service_model_delete (test_name, 0U);
+ assert_eq (ML_ERROR_NONE, status);
+
+ return 0;
+}
+
+/**
+ * @testcase utc_ml_service_get_information_p1
+ * @since_tizen 9.0
+ * @description Positive test case to get information.
+ */
+int utc_ml_service_get_information_p1 (void)
+{
+ IS_SUPPORT_ML_SERVICE_FEATURE;
+ ml_service_h handle = NULL;
+ gchar *value;
+ guint version;
+ const gchar *test_name = "test-single-imgclf";
+
+ /* Clear registered model and don't care the result */
+ status = ml_service_model_delete (test_name, 0U);
+ assert (status == ML_ERROR_NONE || status == ML_ERROR_INVALID_PARAMETER);
+
+ status = ml_service_model_register (test_name, test_model, true, NULL, &version);
+ assert_eq (ML_ERROR_NONE, status);
+
+ status = ml_service_new (config_path, &handle);
+ assert_eq (ML_ERROR_NONE, status);
+ assert (NULL != handle);
+
+ /* Test */
+ status = ml_service_set_information (handle, "test-threshold", "0.1");
+ assert_eq (ML_ERROR_NONE, status);
+
+ status = ml_service_get_information (handle, "test-threshold", &value);
+ assert_eq (ML_ERROR_NONE, status);
+ assert (0 == strcmp ("0.1", value));
+ g_free (value);
+
+ status = ml_service_destroy (handle);
+ assert_eq (ML_ERROR_NONE, status);
+ status = ml_service_model_delete (test_name, 0U);
+ assert_eq (ML_ERROR_NONE, status);
+
+ return 0;
+}
+
+/**
+ * @testcase utc_ml_service_get_information_n1
+ * @since_tizen 9.0
+ * @description Negative test case to get information with invalid param.
+ */
+int utc_ml_service_get_information_n1 (void)
+{
+ IS_SUPPORT_ML_SERVICE_FEATURE;
+ gchar *value;
+
+ /* Test */
+ status = ml_service_get_information (NULL, "test-threshold", &value);
+ assert_eq (ML_ERROR_INVALID_PARAMETER, status);
+
+ return 0;
+}
+
+/**
+ * @testcase utc_ml_service_get_information_n2
+ * @since_tizen 9.0
+ * @description Negative test case to get information with invalid param.
+ */
+int utc_ml_service_get_information_n2 (void)
+{
+ IS_SUPPORT_ML_SERVICE_FEATURE;
+ ml_service_h handle = NULL;
+ gchar *value;
+ guint version;
+ const gchar *test_name = "test-single-imgclf";
+
+ /* Clear registered model and don't care the result */
+ status = ml_service_model_delete (test_name, 0U);
+ assert (status == ML_ERROR_NONE || status == ML_ERROR_INVALID_PARAMETER);
+
+ status = ml_service_model_register (test_name, test_model, true, NULL, &version);
+ assert_eq (ML_ERROR_NONE, status);
+
+ status = ml_service_new (config_path, &handle);
+ assert_eq (ML_ERROR_NONE, status);
+ assert (NULL != handle);
+
+ /* Test */
+ status = ml_service_get_information (handle, NULL, &value);
+ assert_eq (ML_ERROR_INVALID_PARAMETER, status);
+
+ status = ml_service_destroy (handle);
+ assert_eq (ML_ERROR_NONE, status);
+ status = ml_service_model_delete (test_name, 0U);
+ assert_eq (ML_ERROR_NONE, status);
+
+ return 0;
+}
+
+/**
+ * @testcase utc_ml_service_get_information_n3
+ * @since_tizen 9.0
+ * @description Negative test case to get information with invalid param.
+ */
+int utc_ml_service_get_information_n3 (void)
+{
+ IS_SUPPORT_ML_SERVICE_FEATURE;
+ ml_service_h handle = NULL;
+ guint version;
+ const gchar *test_name = "test-single-imgclf";
+
+ /* Clear registered model and don't care the result */
+ status = ml_service_model_delete (test_name, 0U);
+ assert (status == ML_ERROR_NONE || status == ML_ERROR_INVALID_PARAMETER);
+
+ status = ml_service_model_register (test_name, test_model, true, NULL, &version);
+ assert_eq (ML_ERROR_NONE, status);
+
+ status = ml_service_new (config_path, &handle);
+ assert_eq (ML_ERROR_NONE, status);
+ assert (NULL != handle);
+
+ /* Test */
+ status = ml_service_get_information (handle, "test-threshold", NULL);
+ assert_eq (ML_ERROR_INVALID_PARAMETER, status);
+
+ status = ml_service_destroy (handle);
+ assert_eq (ML_ERROR_NONE, status);
+ status = ml_service_model_delete (test_name, 0U);
+ assert_eq (ML_ERROR_NONE, status);
+
+ return 0;
+}
+
+/**
+ * @testcase utc_ml_service_request_p1
+ * @since_tizen 9.0
+ * @description Positive test case to request machine learning service.
+ */
+int utc_ml_service_request_p1 (void)
+{
+ IS_SUPPORT_ML_SERVICE_FEATURE;
+ ml_service_h handle = NULL;
+ ml_tensors_info_h info;
+ guint version;
+ const gchar *test_name = "test-single-imgclf";
+ ml_tensors_data_h input = NULL;
+ guint received = 0, tried = 0;
+
+ /* Clear registered model and don't care the result */
+ status = ml_service_model_delete (test_name, 0U);
+ assert (status == ML_ERROR_NONE || status == ML_ERROR_INVALID_PARAMETER);
+
+ status = ml_service_model_register (test_name, test_model, true, NULL, &version);
+ assert_eq (ML_ERROR_NONE, status);
+
+ status = ml_service_new (config_path, &handle);
+ assert_eq (ML_ERROR_NONE, status);
+ assert (NULL != handle);
+
+ status = ml_service_set_event_cb (handle, _ml_service_test_imgclf_cb, &received);
+ assert_eq (ML_ERROR_NONE, status);
+
+ status = ml_service_get_input_information (handle, NULL, &info);
+ assert_eq (ML_ERROR_NONE, status);
+
+ status = ml_tensors_data_create (info, &input);
+ assert_eq (ML_ERROR_NONE, status);
+
+ /* Test */
+ status = ml_service_request (handle, NULL, input);
+ assert_eq (ML_ERROR_NONE, status);
+
+ do {
+ g_usleep (30000U);
+ } while (received < 1 && tried++ < 10);
+ assert (received > 0);
+
+ status = ml_tensors_info_destroy (info);
+ assert_eq (ML_ERROR_NONE, status);
+ status = ml_tensors_data_destroy (input);
+ assert_eq (ML_ERROR_NONE, status);
+ status = ml_service_destroy (handle);
+ assert_eq (ML_ERROR_NONE, status);
+
+ status = ml_service_model_delete (test_name, 0U);
+ assert_eq (ML_ERROR_NONE, status);
+
+ return 0;
+}
+
+/**
+ * @testcase utc_ml_service_request_n1
+ * @since_tizen 9.0
+ * @description Negative test case to request machine learning service with invalid param.
+ */
+int utc_ml_service_request_n1 (void)
+{
+ IS_SUPPORT_ML_SERVICE_FEATURE;
+ ml_service_h handle = NULL;
+ ml_tensors_info_h info;
+ guint version;
+ const gchar *test_name = "test-single-imgclf";
+ ml_tensors_data_h input = NULL;
+
+ /* Clear registered model and don't care the result */
+ status = ml_service_model_delete (test_name, 0U);
+ assert (status == ML_ERROR_NONE || status == ML_ERROR_INVALID_PARAMETER);
+
+ status = ml_service_model_register (test_name, test_model, true, NULL, &version);
+ assert_eq (ML_ERROR_NONE, status);
+
+ status = ml_service_new (config_path, &handle);
+ assert_eq (ML_ERROR_NONE, status);
+ assert (NULL != handle);
+
+ status = ml_service_get_input_information (handle, NULL, &info);
+ assert_eq (ML_ERROR_NONE, status);
+
+ status = ml_tensors_data_create (info, &input);
+ assert_eq (ML_ERROR_NONE, status);
+
+ /* Test */
+ status = ml_service_request (NULL, NULL, input);
+ assert_eq (ML_ERROR_INVALID_PARAMETER, status);
+
+ status = ml_tensors_info_destroy (info);
+ assert_eq (ML_ERROR_NONE, status);
+ status = ml_tensors_data_destroy (input);
+ assert_eq (ML_ERROR_NONE, status);
+ status = ml_service_destroy (handle);
+ assert_eq (ML_ERROR_NONE, status);
+
+ status = ml_service_model_delete (test_name, 0U);
+ assert_eq (ML_ERROR_NONE, status);
+
+ return 0;
+}
+
+/**
+ * @testcase utc_ml_service_request_n2
+ * @since_tizen 9.0
+ * @description Negative test case to request machine learning service with invalid param.
+ */
+int utc_ml_service_request_n2 (void)
+{
+ IS_SUPPORT_ML_SERVICE_FEATURE;
+ ml_service_h handle = NULL;
+ guint version;
+ const gchar *test_name = "test-single-imgclf";
+
+ /* Clear registered model and don't care the result */
+ status = ml_service_model_delete (test_name, 0U);
+ assert (status == ML_ERROR_NONE || status == ML_ERROR_INVALID_PARAMETER);
+
+ status = ml_service_model_register (test_name, test_model, true, NULL, &version);
+ assert_eq (ML_ERROR_NONE, status);
+
+ status = ml_service_new (config_path, &handle);
+ assert_eq (ML_ERROR_NONE, status);
+ assert (NULL != handle);
+
+ /* Test */
+ status = ml_service_request (handle, NULL, NULL);
+ assert_eq (ML_ERROR_INVALID_PARAMETER, status);
+
+ status = ml_service_destroy (handle);
+ assert_eq (ML_ERROR_NONE, status);
+
+ status = ml_service_model_delete (test_name, 0U);
+ assert_eq (ML_ERROR_NONE, status);
+
+ return 0;
+}
return 0;
}
+
+/**
+ * @testcase utc_ml_tensors_data_clone_p
+ * @since_tizen 9.0
+ * @description Test utility functions - clone data.
+ */
+int utc_ml_tensors_data_clone_p (void)
+{
+ IS_SUPPORT_FEATURE;
+ int status;
+ ml_tensors_info_h info;
+ ml_tensors_data_h data;
+ ml_tensors_data_h data_out;
+ ml_tensor_dimension dim = { 5, 1, 1, 1 };
+ const int raw_data[5] = { 10, 20, 30, 40, 50 };
+ int *result = NULL;
+ size_t data_size, result_size;
+
+ status = ml_tensors_info_create (&info);
+ assert_eq (ML_ERROR_NONE, status);
+ status = ml_tensors_info_set_count (info, 1);
+ assert_eq (ML_ERROR_NONE, status);
+ status = ml_tensors_info_set_tensor_type (info, 0, ML_TENSOR_TYPE_INT32);
+ assert_eq (ML_ERROR_NONE, status);
+ status= ml_tensors_info_set_tensor_dimension (info, 0, dim);
+ assert_eq (ML_ERROR_NONE, status);
+ status = ml_tensors_info_get_tensor_size (info, 0, &data_size);
+ assert_eq (ML_ERROR_NONE, status);
+ status = ml_tensors_data_create (info, &data);
+ assert_eq (ML_ERROR_NONE, status);
+
+ status = ml_tensors_data_set_tensor_data (data, 0, (const void *) raw_data, data_size);
+ assert_eq (ML_ERROR_NONE, status);
+
+ status = ml_tensors_data_clone (data, &data_out);
+ assert_eq (ML_ERROR_NONE, status);
+
+ status = ml_tensors_data_get_tensor_data (data_out, 0, (void **) &result, &result_size);
+ assert_eq (ML_ERROR_NONE, status);
+ for (unsigned int i = 0; i < 5; i++)
+ assert_eq (result[i], raw_data[i]);
+
+ status = ml_tensors_info_destroy (info);
+ assert_eq (ML_ERROR_NONE, status);
+ status = ml_tensors_data_destroy (data);
+ assert_eq (ML_ERROR_NONE, status);
+ status = ml_tensors_data_destroy (data_out);
+ assert_eq (ML_ERROR_NONE, status);
+
+ return 0;
+}
+
+/**
+ * @testcase utc_ml_tensors_data_clone_n1
+ * @since_tizen 9.0
+ * @description Test utility functions - clone data, Failure case
+ */
+int utc_ml_tensors_data_clone_n1 (void)
+{
+ IS_SUPPORT_FEATURE;
+ int status;
+ ml_tensors_info_h info;
+ ml_tensors_data_h data;
+ ml_tensor_dimension dim = { 5, 1, 1, 1 };
+
+ status = ml_tensors_info_create (&info);
+ assert_eq (ML_ERROR_NONE, status);
+ status = ml_tensors_info_set_count (info, 1);
+ assert_eq (ML_ERROR_NONE, status);
+ status = ml_tensors_info_set_tensor_type (info, 0, ML_TENSOR_TYPE_INT32);
+ assert_eq (ML_ERROR_NONE, status);
+ status= ml_tensors_info_set_tensor_dimension (info, 0, dim);
+ assert_eq (ML_ERROR_NONE, status);
+ status = ml_tensors_data_create (info, &data);
+ assert_eq (ML_ERROR_NONE, status);
+
+ status = ml_tensors_data_clone (data, NULL);
+ assert_eq (ML_ERROR_INVALID_PARAMETER, status);
+
+ status = ml_tensors_info_destroy (info);
+ assert_eq (ML_ERROR_NONE, status);
+ status = ml_tensors_data_destroy (data);
+ assert_eq (ML_ERROR_NONE, status);
+
+ return 0;
+}
+
+/**
+ * @testcase utc_ml_tensors_data_clone_n2
+ * @since_tizen 9.0
+ * @description Test utility functions - clone data, Failure case
+ */
+int utc_ml_tensors_data_clone_n2 (void)
+{
+ IS_SUPPORT_FEATURE;
+ int status;
+ ml_tensors_data_h data_out = NULL;
+
+ status = ml_tensors_data_clone (NULL, data_out);
+ assert_eq (status, ML_ERROR_INVALID_PARAMETER);
+
+ return 0;
+}
+
+/**
+ * @testcase utc_ml_tensors_data_get_info_p
+ * @since_tizen 9.0
+ * @description Test utility functions - get data info
+ */
+int utc_ml_tensors_data_get_info_p (void)
+{
+ IS_SUPPORT_FEATURE;
+ int status;
+ ml_tensors_info_h in_info, out_info;
+ ml_tensors_data_h data;
+ ml_tensor_dimension dim = { 5, 1, 1, 1 };
+
+ status = ml_tensors_info_create (&in_info);
+ assert_eq (ML_ERROR_NONE, status);
+ status = ml_tensors_info_set_count (in_info, 1);
+ assert_eq (ML_ERROR_NONE, status);
+ status = ml_tensors_info_set_tensor_type (in_info, 0, ML_TENSOR_TYPE_INT32);
+ assert_eq (ML_ERROR_NONE, status);
+ status = ml_tensors_info_set_tensor_dimension (in_info, 0, dim);
+ assert_eq (ML_ERROR_NONE, status);
+ status = ml_tensors_data_create (in_info, &data);
+ assert_eq (ML_ERROR_NONE, status);
+
+ status = ml_tensors_data_get_info (data, &out_info);
+ assert_eq (ML_ERROR_NONE, status);
+
+ status = ml_tensors_info_destroy (in_info);
+ assert_eq (ML_ERROR_NONE, status);
+ status = ml_tensors_info_destroy (out_info);
+ assert_eq (ML_ERROR_NONE, status);
+ status = ml_tensors_data_destroy (data);
+ assert_eq (ML_ERROR_NONE, status);
+
+ return 0;
+}
+
+/**
+ * @testcase utc_ml_tensors_data_get_info_n1
+ * @since_tizen 9.0
+ * @description Test utility functions - get data info, Failure case
+ */
+int utc_ml_tensors_data_get_info_n1 (void)
+{
+ IS_SUPPORT_FEATURE;
+ int status;
+ ml_tensors_info_h in_info;
+ ml_tensors_data_h data;
+ ml_tensor_dimension dim = { 5, 1, 1, 1 };
+
+ status = ml_tensors_info_create (&in_info);
+ assert_eq (ML_ERROR_NONE, status);
+ status = ml_tensors_info_set_count (in_info, 1);
+ assert_eq (ML_ERROR_NONE, status);
+ status = ml_tensors_info_set_tensor_type (in_info, 0, ML_TENSOR_TYPE_INT32);
+ assert_eq (ML_ERROR_NONE, status);
+ status = ml_tensors_info_set_tensor_dimension (in_info, 0, dim);
+ assert_eq (ML_ERROR_NONE, status);
+ status = ml_tensors_data_create (in_info, &data);
+ assert_eq (ML_ERROR_NONE, status);
+
+ status = ml_tensors_data_get_info (data, NULL);
+ assert_eq (ML_ERROR_INVALID_PARAMETER, status);
+
+ status = ml_tensors_info_destroy (in_info);
+ assert_eq (ML_ERROR_NONE, status);
+ status = ml_tensors_data_destroy (data);
+ assert_eq (ML_ERROR_NONE, status);
+
+ return 0;
+}
+
+/**
+ * @testcase utc_ml_tensors_data_get_info_n2
+ * @since_tizen 9.0
+ * @description Test utility functions - get data info, Failure case
+ */
+int utc_ml_tensors_data_get_info_n2 (void)
+{
+ IS_SUPPORT_FEATURE;
+ int status;
+ ml_tensors_info_h out_info;
+
+ status = ml_tensors_data_get_info (NULL, &out_info);
+ assert_eq (ML_ERROR_INVALID_PARAMETER, status);
+
+ return 0;
+}