sl@0: /* sl@0: * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). sl@0: * All rights reserved. sl@0: * This component and the accompanying materials are made available sl@0: * under the terms of "Eclipse Public License v1.0" sl@0: * which accompanies this distribution, and is available sl@0: * at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: * sl@0: * Initial Contributors: sl@0: * Nokia Corporation - initial contribution. sl@0: * sl@0: * Contributors: sl@0: * sl@0: * Description: sl@0: * sl@0: */ sl@0: sl@0: sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: sl@0: #include sl@0: sl@0: #define LOG_FILE "c:\\logs\\testsuite_function_log.txt" sl@0: #include "std_log_result.h" sl@0: #define LOG_FILENAME_LINE __FILE__, __LINE__ sl@0: sl@0: #define SIZE 20 sl@0: sl@0: void create_xml(int result) sl@0: { sl@0: if(result) sl@0: assert_failed = 1; sl@0: sl@0: testResultXml("testsuite_function"); sl@0: close_log_file(); sl@0: } sl@0: sl@0: void abs_f32_f32_test(float * dest, int dstr, const float * src, int sstr, int n) sl@0: { sl@0: int i = 0; sl@0: std_log(LOG_FILENAME_LINE,"abs_f32_f32_test is called"); sl@0: assert_failed = 0; sl@0: sl@0: for(i=0; ifunc = (void*)abs_f32_f32_test; sl@0: impl->name = "abs_f32_f32_test"; sl@0: sl@0: oil_class_register_impl_by_name("abs_f32_f32", impl); sl@0: sl@0: assert_failed = 1; //will be set to 0, if abs_f32_f32_test is called sl@0: oil_abs_f32_f32(output, 1, input, 2, SIZE); sl@0: } sl@0: else sl@0: { sl@0: std_log(LOG_FILENAME_LINE,"memory allocation failed. errno = %d", errno); sl@0: assert_failed = 1; sl@0: } sl@0: } sl@0: sl@0: void test_oil_class_register_impl() sl@0: { sl@0: float output[SIZE]; sl@0: float input[SIZE]; sl@0: sl@0: OilFunctionClass *klass; sl@0: OilFunctionImpl *impl; sl@0: sl@0: if(impl != NULL) sl@0: { sl@0: impl = (OilFunctionImpl*)calloc(sizeof(OilFunctionImpl), 0); sl@0: impl->func = (void *)abs_f32_f32_test; sl@0: impl->name = "abs_f32_f32_test"; sl@0: sl@0: klass = (OilFunctionClass *)oil_class_get ("abs_f32_f32"); sl@0: sl@0: if(klass != NULL) sl@0: { sl@0: oil_class_register_impl(klass, impl); sl@0: sl@0: assert_failed = 1; //will be set to 0, if abs_f32_f32_test is called sl@0: oil_abs_f32_f32(output, 1, input, 2, SIZE); sl@0: } sl@0: else sl@0: { sl@0: std_log(LOG_FILENAME_LINE,"oil_class_get returned NULL. errno = %d", errno); sl@0: assert_failed = 1; sl@0: } sl@0: } sl@0: else sl@0: { sl@0: std_log(LOG_FILENAME_LINE,"memory allocation failed. errno = %d", errno); sl@0: assert_failed = 1; sl@0: } sl@0: } sl@0: sl@0: void test_oil_class_register_impl_full() sl@0: { sl@0: float output[SIZE]; sl@0: float input[SIZE]; sl@0: OilFunctionClass *klass; sl@0: sl@0: klass = (OilFunctionClass *)oil_class_get ("abs_f32_f32"); sl@0: sl@0: if(klass != NULL) sl@0: { sl@0: oil_class_register_impl_full(klass, (void*)abs_f32_f32_test, "abs_f32_f32_test", OIL_IMPL_FLAG_OPT); sl@0: sl@0: assert_failed = 1; //will be set to 0, if abs_f32_f32_test is called sl@0: oil_abs_f32_f32(output, 1, input, 2, SIZE); sl@0: } sl@0: else sl@0: { sl@0: std_log(LOG_FILENAME_LINE,"oil_class_get returned NULL. errno = %d", errno); sl@0: assert_failed = 1; sl@0: } sl@0: } sl@0: sl@0: int main (int argc, char *argv[]) sl@0: { sl@0: oil_init(); sl@0: oil_init_no_optimize(); sl@0: oil_optimize("abs_f32_f32"); sl@0: sl@0: sl@0: test_oil_class_register_impl_by_name(); sl@0: test_oil_class_register_impl(); sl@0: test_oil_class_register_impl_full(); sl@0: sl@0: if(assert_failed) sl@0: std_log(LOG_FILENAME_LINE,"Test Failed"); sl@0: else sl@0: std_log(LOG_FILENAME_LINE,"Test Successful"); sl@0: create_xml(0); sl@0: return 0; sl@0: } sl@0: