sl@0: /* sl@0: * LIBOIL - Library of Optimized Inner Loops sl@0: * Copyright (c) 2003,2004 David A. Schleef sl@0: * All rights reserved. sl@0: * sl@0: * Redistribution and use in source and binary forms, with or without sl@0: * modification, are permitted provided that the following conditions sl@0: * are met: sl@0: * 1. Redistributions of source code must retain the above copyright sl@0: * notice, this list of conditions and the following disclaimer. sl@0: * 2. Redistributions in binary form must reproduce the above copyright sl@0: * notice, this list of conditions and the following disclaimer in the sl@0: * documentation and/or other materials provided with the distribution. sl@0: * sl@0: * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR sl@0: * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED sl@0: * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE sl@0: * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, sl@0: * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES sl@0: * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR sl@0: * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) sl@0: * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, sl@0: * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING sl@0: * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE sl@0: * POSSIBILITY OF SUCH DAMAGE. sl@0: */ sl@0: sl@0: #ifndef _LIBOIL_TEST_H_ sl@0: #define _LIBOIL_TEST_H_ sl@0: sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: sl@0: OIL_BEGIN_DECLS sl@0: sl@0: #ifdef OIL_ENABLE_UNSTABLE_API sl@0: sl@0: /** sl@0: * OilTest: sl@0: * sl@0: * An opaque structure describing how to test an OilFunctionImpl sl@0: * for an OilFunctionClass. sl@0: */ sl@0: struct _OilTest { sl@0: /*< private >*/ sl@0: OilFunctionClass *klass; sl@0: OilFunctionImpl *impl; sl@0: OilPrototype *proto; sl@0: OilParameter params[OIL_ARG_LAST]; sl@0: OilProfile prof; sl@0: sl@0: int iterations; sl@0: int n; sl@0: int m; sl@0: sl@0: int inited; sl@0: int tested_ref; sl@0: sl@0: double sum_abs_diff; sl@0: int n_points; sl@0: sl@0: double profile_ave; sl@0: double profile_std; sl@0: sl@0: double tolerance; sl@0: }; sl@0: sl@0: /** sl@0: * OilTestFunction: sl@0: * @test: the @OilTest structure sl@0: * sl@0: * Typedef for functions that initialize special values sl@0: * in source arrays for a particular function class. sl@0: */ sl@0: //typedef void (*OilTestFunction) (OilTest *test); sl@0: sl@0: /** sl@0: * OIL_TEST_HEADER: sl@0: * sl@0: * Default number of bytes that are prepended to the array test area. sl@0: */ sl@0: #define OIL_TEST_HEADER 256 sl@0: /** sl@0: * OIL_TEST_FOOTER: sl@0: * sl@0: * Default number of bytes that are appended to the array test area. sl@0: */ sl@0: #define OIL_TEST_FOOTER 256 sl@0: sl@0: IMPORT_C OilTest *oil_test_new (OilFunctionClass *klass); sl@0: IMPORT_C void oil_test_free (OilTest *test); sl@0: sl@0: IMPORT_C void oil_test_set_iterations (OilTest *test, int iterations); sl@0: sl@0: IMPORT_C void oil_test_check_ref (OilTest *test); sl@0: IMPORT_C int oil_test_check_impl (OilTest *test, OilFunctionImpl *impl); sl@0: sl@0: IMPORT_C void oil_test_cleanup (OilTest *test); sl@0: IMPORT_C void oil_test_init (OilTest *test); sl@0: sl@0: IMPORT_C void oil_test_set_test_header (OilTest *test, OilParameter *p, int test_header); sl@0: IMPORT_C void oil_test_set_test_footer (OilTest *test, OilParameter *p, int test_footer); sl@0: sl@0: void _oil_test_marshal_function (void *func, unsigned long *args, int n_args, sl@0: unsigned int pointer_mask, OilProfile *prof); sl@0: sl@0: IMPORT_C void *oil_test_get_source_data (OilTest *test, OilArgType arg_type); sl@0: IMPORT_C int oil_test_get_arg_pre_n (OilTest *test, OilArgType arg_type); sl@0: IMPORT_C int oil_test_get_arg_post_n (OilTest *test, OilArgType arg_type); sl@0: IMPORT_C int oil_test_get_arg_stride (OilTest *test, OilArgType arg_type); sl@0: IMPORT_C int oil_test_get_value (OilTest *test, OilArgType arg_type); sl@0: sl@0: #endif sl@0: sl@0: OIL_END_DECLS sl@0: sl@0: #endif sl@0: