os/ossrv/genericopenlibs/liboil/tsrc/testsuite/proto3/src/proto3.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/proto3/src/proto3.c	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,155 @@
     1.4 +/*
     1.5 + * LIBOIL - Library of Optimized Inner Loops
     1.6 + * Copyright (c) 2004 David A. Schleef <ds@schleef.org>
     1.7 + * All rights reserved.
     1.8 + *
     1.9 + * Redistribution and use in source and binary forms, with or without
    1.10 + * modification, are permitted provided that the following conditions
    1.11 + * are met:
    1.12 + * 1. Redistributions of source code must retain the above copyright
    1.13 + *    notice, this list of conditions and the following disclaimer.
    1.14 + * 2. Redistributions in binary form must reproduce the above copyright
    1.15 + *    notice, this list of conditions and the following disclaimer in the
    1.16 + *    documentation and/or other materials provided with the distribution.
    1.17 + * 
    1.18 + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
    1.19 + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
    1.20 + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
    1.21 + * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
    1.22 + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
    1.23 + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
    1.24 + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
    1.25 + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
    1.26 + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
    1.27 + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
    1.28 + * POSSIBILITY OF SUCH DAMAGE.
    1.29 + */
    1.30 +
    1.31 +
    1.32 +#include <stdio.h>
    1.33 +#include <liboil/liboilprototype.h>
    1.34 +#include <liboil/liboil.h>
    1.35 +#include <ctype.h>
    1.36 +#include <stdlib.h>
    1.37 +#include <string.h>
    1.38 +
    1.39 +#include <liboil/globals.h>
    1.40 +
    1.41 +#define LOG_FILE "c:\\logs\\testsuite_proto3_log1.txt"
    1.42 +#include "std_log_result.h"
    1.43 +#define LOG_FILENAME_LINE __FILE__, __LINE__
    1.44 +
    1.45 +void create_xml(int result)
    1.46 +{
    1.47 +    if(result)
    1.48 +        assert_failed = 1;
    1.49 +    
    1.50 +    testResultXml("testsuite_proto3");
    1.51 +    close_log_file();
    1.52 +}
    1.53 +
    1.54 +void print_param (OilParameter *param);
    1.55 +
    1.56 +/* format:
    1.57 + * <isd>[s][0-9*][_[<0-9*,nm[p0-9*]>x]<0-9*,nm[p0-9*]>] */
    1.58 +
    1.59 +char *good_params[] = {
    1.60 +  "d",
    1.61 +  "s",
    1.62 +  "i",
    1.63 +  "d1",
    1.64 +  "d2",
    1.65 +  "ds",
    1.66 +  "ss",
    1.67 +  "is",
    1.68 +  "ds1",
    1.69 +  "ds2",
    1.70 +  "d_1",
    1.71 +  "d_2",
    1.72 +  "d_4",
    1.73 +  "d_n",
    1.74 +  "d_1xn",
    1.75 +  "d_4xn",
    1.76 +  "d_nxm",
    1.77 +  "d_8x8",
    1.78 +  "d_np2",
    1.79 +  NULL
    1.80 +};
    1.81 +
    1.82 +char *bad_params[] = {
    1.83 +  "e",
    1.84 +  NULL
    1.85 +};
    1.86 +
    1.87 +int main (int argc, char *argv[])
    1.88 +{
    1.89 +  int i;
    1.90 +  int ret;
    1.91 +  int failed = 0;
    1.92 +  OilParameter param;
    1.93 +  
    1.94 +  //xmlfile = "proto3";
    1.95 +  std_log(LOG_FILENAME_LINE, "Test Started testsuite_proto3");
    1.96 +
    1.97 +  for(i=0;good_params[i];i++){
    1.98 +    ret = oil_param_from_string (&param, good_params[i]);
    1.99 +    if (!ret) {
   1.100 +      printf("***ERROR***\n");
   1.101 +      std_log(LOG_FILENAME_LINE, "***ERROR***");
   1.102 +      failed = 1;
   1.103 +    }
   1.104 +    print_param (&param);
   1.105 +  }
   1.106 +
   1.107 +  for(i=0;bad_params[i];i++){
   1.108 +    ret = oil_param_from_string (&param, bad_params[i]);
   1.109 +    if (ret) {
   1.110 +      printf("***ERROR***\n");
   1.111 +      std_log(LOG_FILENAME_LINE, "***ERROR***");
   1.112 +      failed = 1;
   1.113 +    }
   1.114 +  }
   1.115 +  std_log(LOG_FILENAME_LINE, "Test Successful");
   1.116 +  create_xml(0);
   1.117 +  return failed;
   1.118 +}
   1.119 +
   1.120 +void print_param (OilParameter *param)
   1.121 +{
   1.122 +  if (param->is_stride) 
   1.123 +  {
   1.124 +      printf ("  %cs%d\n", param->direction, param->index);
   1.125 +  } 
   1.126 +  else 
   1.127 +  {
   1.128 +      printf ("  %c%d_", param->direction, param->index);
   1.129 +      if (param->prestride_var > 0) 
   1.130 +      {
   1.131 +          printf("%c", (param->prestride_var==1) ? 'n' : 'm');
   1.132 +          if (param->prestride_length) 
   1.133 +          {
   1.134 +              printf("p%d", param->prestride_length);
   1.135 +          }
   1.136 +      } 
   1.137 +      else 
   1.138 +      {
   1.139 +          printf("%d", param->prestride_length);
   1.140 +      }
   1.141 +      printf("x");
   1.142 +      if (param->poststride_var > 0) 
   1.143 +      {
   1.144 +          printf("%c", (param->poststride_var==1) ? 'n' : 'm');
   1.145 +          if (param->poststride_length) 
   1.146 +          {
   1.147 +              printf("p%d", param->poststride_length);
   1.148 +          }
   1.149 +      } 
   1.150 +      else
   1.151 +      {
   1.152 +          printf("%d", param->poststride_length);
   1.153 +      }
   1.154 +      printf("\n");
   1.155 +  }
   1.156 +
   1.157 +}
   1.158 +