genericopenlibs/liboil/tsrc/testsuite/ref/src/splat.c
changeset 50 79045913e4e9
equal deleted inserted replaced
49:e5d77a29bdca 50:79045913e4e9
       
     1 // Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 
       
    17 
       
    18 #ifdef HAVE_CONFIG_H
       
    19 #include "config.h"
       
    20 #endif
       
    21 
       
    22 #include <liboil/liboil.h>
       
    23 #include <liboil/liboilfunction.h>
       
    24 #include <stdio.h>
       
    25 #include <string.h>
       
    26 #include <globals.h>
       
    27 
       
    28 #define LOG_FILE "c:\\logs\\testsuite_splat_log.txt"
       
    29 #include "std_log_result.h"
       
    30 #define LOG_FILENAME_LINE __FILE__, __LINE__
       
    31 #define MAX_SIZE 10
       
    32 #define SIZE 1
       
    33 
       
    34 
       
    35 void create_xml(int result)
       
    36 {
       
    37     if(result)
       
    38         assert_failed = 1;
       
    39     
       
    40     testResultXml("testsuite_splat");
       
    41     close_log_file();
       
    42 }
       
    43 
       
    44 void test_splat_u16_ns()
       
    45     {
       
    46     int i;
       
    47     uint16_t sp1[SIZE]={10},res[MAX_SIZE];
       
    48     uint16_t check[MAX_SIZE]={10,10,10,10,10,10,10,10,10,10};
       
    49     
       
    50     for(i=0;i<MAX_SIZE;i++)
       
    51         res[i]=0;
       
    52         
       
    53     oil_splat_u16_ns(res,sp1,MAX_SIZE);
       
    54     
       
    55     for(i=0;i<MAX_SIZE;i++)
       
    56     if(check[i] == res[i])
       
    57           {
       
    58           std_log(LOG_FILENAME_LINE,"oil_splat_u16_ns successful, res[%d]=%d", i,res[i]);
       
    59           }
       
    60      else
       
    61          {
       
    62          assert_failed=1;
       
    63          std_log(LOG_FILENAME_LINE,"oil_splat_u16_ns unsuccessful, Expected =%d,Obtained =%d",check[i],res[i]);
       
    64          }
       
    65     }
       
    66 
       
    67 
       
    68 void test_splat_u32()
       
    69     {
       
    70     int i;
       
    71     uint32_t sp1[SIZE]={5},res[MAX_SIZE];
       
    72     uint32_t check[MAX_SIZE]={84215045,84215045,1285,0,0,0,0,0,0,0};
       
    73     
       
    74     for(i=0;i<MAX_SIZE;i++)
       
    75         res[i]=0;
       
    76         
       
    77     oil_splat_u32(res,1,sp1,MAX_SIZE);
       
    78        
       
    79     for(i=0;i<MAX_SIZE;i++)
       
    80     if(check[i] == res[i])
       
    81           {
       
    82           std_log(LOG_FILENAME_LINE,"oil_splat_u32 successful,res[%d]=%d",i,res[i]);
       
    83           }
       
    84      else
       
    85          {
       
    86          assert_failed=1;
       
    87          std_log(LOG_FILENAME_LINE,"oil_splat_u32 unsuccessful, Expected =%d,Obtained =%d",check[i],res[i]);
       
    88          }
       
    89     }
       
    90 
       
    91 int main ()
       
    92 {
       
    93   std_log(LOG_FILENAME_LINE,"Test started testsuite_splat");
       
    94   oil_init ();
       
    95   
       
    96   std_log(LOG_FILENAME_LINE,"oil_splat_u16_ns");
       
    97   test_splat_u16_ns();
       
    98   
       
    99   std_log(LOG_FILENAME_LINE,"oil_splat_u32");
       
   100   test_splat_u32();
       
   101   
       
   102   if(assert_failed)
       
   103          std_log(LOG_FILENAME_LINE,"Test Fail");
       
   104   else
       
   105          std_log(LOG_FILENAME_LINE,"Test Successful");
       
   106    
       
   107   create_xml(0);
       
   108   return 0;
       
   109 }
       
   110