os/ossrv/genericopenlibs/liboil/tsrc/testsuite/ref/src/splat.c
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/ossrv/genericopenlibs/liboil/tsrc/testsuite/ref/src/splat.c	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,110 @@
     1.4 +// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
     1.5 +// All rights reserved.
     1.6 +// This component and the accompanying materials are made available
     1.7 +// under the terms of "Eclipse Public License v1.0"
     1.8 +// which accompanies this distribution, and is available
     1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.10 +//
    1.11 +// Initial Contributors:
    1.12 +// Nokia Corporation - initial contribution.
    1.13 +//
    1.14 +// Contributors:
    1.15 +//
    1.16 +// Description:
    1.17 +//
    1.18 +
    1.19 +
    1.20 +
    1.21 +#ifdef HAVE_CONFIG_H
    1.22 +#include "config.h"
    1.23 +#endif
    1.24 +
    1.25 +#include <liboil/liboil.h>
    1.26 +#include <liboil/liboilfunction.h>
    1.27 +#include <stdio.h>
    1.28 +#include <string.h>
    1.29 +#include <globals.h>
    1.30 +
    1.31 +#define LOG_FILE "c:\\logs\\testsuite_splat_log.txt"
    1.32 +#include "std_log_result.h"
    1.33 +#define LOG_FILENAME_LINE __FILE__, __LINE__
    1.34 +#define MAX_SIZE 10
    1.35 +#define SIZE 1
    1.36 +
    1.37 +
    1.38 +void create_xml(int result)
    1.39 +{
    1.40 +    if(result)
    1.41 +        assert_failed = 1;
    1.42 +    
    1.43 +    testResultXml("testsuite_splat");
    1.44 +    close_log_file();
    1.45 +}
    1.46 +
    1.47 +void test_splat_u16_ns()
    1.48 +    {
    1.49 +    int i;
    1.50 +    uint16_t sp1[SIZE]={10},res[MAX_SIZE];
    1.51 +    uint16_t check[MAX_SIZE]={10,10,10,10,10,10,10,10,10,10};
    1.52 +    
    1.53 +    for(i=0;i<MAX_SIZE;i++)
    1.54 +        res[i]=0;
    1.55 +        
    1.56 +    oil_splat_u16_ns(res,sp1,MAX_SIZE);
    1.57 +    
    1.58 +    for(i=0;i<MAX_SIZE;i++)
    1.59 +    if(check[i] == res[i])
    1.60 +          {
    1.61 +          std_log(LOG_FILENAME_LINE,"oil_splat_u16_ns successful, res[%d]=%d", i,res[i]);
    1.62 +          }
    1.63 +     else
    1.64 +         {
    1.65 +         assert_failed=1;
    1.66 +         std_log(LOG_FILENAME_LINE,"oil_splat_u16_ns unsuccessful, Expected =%d,Obtained =%d",check[i],res[i]);
    1.67 +         }
    1.68 +    }
    1.69 +
    1.70 +
    1.71 +void test_splat_u32()
    1.72 +    {
    1.73 +    int i;
    1.74 +    uint32_t sp1[SIZE]={5},res[MAX_SIZE];
    1.75 +    uint32_t check[MAX_SIZE]={84215045,84215045,1285,0,0,0,0,0,0,0};
    1.76 +    
    1.77 +    for(i=0;i<MAX_SIZE;i++)
    1.78 +        res[i]=0;
    1.79 +        
    1.80 +    oil_splat_u32(res,1,sp1,MAX_SIZE);
    1.81 +       
    1.82 +    for(i=0;i<MAX_SIZE;i++)
    1.83 +    if(check[i] == res[i])
    1.84 +          {
    1.85 +          std_log(LOG_FILENAME_LINE,"oil_splat_u32 successful,res[%d]=%d",i,res[i]);
    1.86 +          }
    1.87 +     else
    1.88 +         {
    1.89 +         assert_failed=1;
    1.90 +         std_log(LOG_FILENAME_LINE,"oil_splat_u32 unsuccessful, Expected =%d,Obtained =%d",check[i],res[i]);
    1.91 +         }
    1.92 +    }
    1.93 +
    1.94 +int main ()
    1.95 +{
    1.96 +  std_log(LOG_FILENAME_LINE,"Test started testsuite_splat");
    1.97 +  oil_init ();
    1.98 +  
    1.99 +  std_log(LOG_FILENAME_LINE,"oil_splat_u16_ns");
   1.100 +  test_splat_u16_ns();
   1.101 +  
   1.102 +  std_log(LOG_FILENAME_LINE,"oil_splat_u32");
   1.103 +  test_splat_u32();
   1.104 +  
   1.105 +  if(assert_failed)
   1.106 +         std_log(LOG_FILENAME_LINE,"Test Fail");
   1.107 +  else
   1.108 +         std_log(LOG_FILENAME_LINE,"Test Successful");
   1.109 +   
   1.110 +  create_xml(0);
   1.111 +  return 0;
   1.112 +}
   1.113 +