1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/ossrv/genericopenlibs/liboil/tsrc/testsuite/copy/src/copy.c Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,93 @@
1.4 +/*
1.5 +* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
1.6 +* All rights reserved.
1.7 +* This component and the accompanying materials are made available
1.8 +* under the terms of "Eclipse Public License v1.0"
1.9 +* which accompanies this distribution, and is available
1.10 +* at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.11 +*
1.12 +* Initial Contributors:
1.13 +* Nokia Corporation - initial contribution.
1.14 +*
1.15 +* Contributors:
1.16 +*
1.17 +* Description:
1.18 +*
1.19 +*/
1.20 +
1.21 +
1.22 +#ifdef HAVE_CONFIG_H
1.23 +#include "config.h"
1.24 +#endif
1.25 +
1.26 +#include <liboil/liboil.h>
1.27 +#include <liboil/liboilfunction.h>
1.28 +#include <stdio.h>
1.29 +#include <string.h>
1.30 +#include <liboil/globals.h>
1.31 +
1.32 +#define LOG_FILE "c:\\logs\\testsuite_copy_log.txt"
1.33 +#include "std_log_result.h"
1.34 +#define LOG_FILENAME_LINE __FILE__, __LINE__
1.35 +
1.36 +void create_xml(int result)
1.37 +{
1.38 + if(result)
1.39 + assert_failed = 1;
1.40 +
1.41 + testResultXml("testsuite_copy");
1.42 + close_log_file();
1.43 +}
1.44 +
1.45 +uint8_t dest[200];
1.46 +uint8_t src[200];
1.47 +
1.48 +
1.49 +void test(void)
1.50 +{
1.51 + int i;
1.52 +
1.53 + for(i=0;i<200;i++){
1.54 + dest[i]=0;
1.55 + src[i]=i;
1.56 + }
1.57 +
1.58 + oil_copy_u8 (dest + 8, src + 0, 64);
1.59 +
1.60 + for(i=0;i<100;i++){
1.61 + if(i<8 || i>71)
1.62 + assert_failed = (dest[i] == 0) ? assert_failed : 1;
1.63 + else
1.64 + assert_failed = (dest[i] == (i-8)) ? assert_failed : 1;
1.65 + std_log(LOG_FILENAME_LINE,"%d\n",dest[i]);
1.66 + }
1.67 +}
1.68 +
1.69 +int main (int argc, char *argv[])
1.70 +{
1.71 + OilFunctionClass *klass;
1.72 + OilFunctionImpl *impl;
1.73 +
1.74 + std_log(LOG_FILENAME_LINE,"Test started testsuite_copy");
1.75 + oil_init ();
1.76 +
1.77 + klass = (OilFunctionClass *)oil_class_get ("copy_u8");
1.78 + oil_class_optimize(klass);
1.79 +
1.80 + oil_class_choose_by_name (klass, "copy_u8_altivec");
1.81 + impl = klass->chosen_impl;
1.82 + if (oil_impl_is_runnable (impl)) {
1.83 + std_log(LOG_FILENAME_LINE,"chosen=%p\n", impl);
1.84 + impl = klass->reference_impl;
1.85 + std_log(LOG_FILENAME_LINE,"ref=%p\n", impl);
1.86 + test();
1.87 + }
1.88 +
1.89 + if(assert_failed)
1.90 + std_log(LOG_FILENAME_LINE,"Test Fail");
1.91 + else
1.92 + std_log(LOG_FILENAME_LINE,"Test Successful");
1.93 + create_xml(0);
1.94 + return 0;
1.95 +}
1.96 +