sl@0
|
1 |
/*
|
sl@0
|
2 |
* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
3 |
* All rights reserved.
|
sl@0
|
4 |
* This component and the accompanying materials are made available
|
sl@0
|
5 |
* under the terms of "Eclipse Public License v1.0"
|
sl@0
|
6 |
* which accompanies this distribution, and is available
|
sl@0
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
8 |
*
|
sl@0
|
9 |
* Initial Contributors:
|
sl@0
|
10 |
* Nokia Corporation - initial contribution.
|
sl@0
|
11 |
*
|
sl@0
|
12 |
* Contributors:
|
sl@0
|
13 |
*
|
sl@0
|
14 |
* Description:
|
sl@0
|
15 |
*
|
sl@0
|
16 |
*/
|
sl@0
|
17 |
|
sl@0
|
18 |
|
sl@0
|
19 |
#include <liboil/liboil.h>
|
sl@0
|
20 |
#include <liboil/liboilfunction.h>
|
sl@0
|
21 |
#include <stdio.h>
|
sl@0
|
22 |
#include <stdlib.h>
|
sl@0
|
23 |
|
sl@0
|
24 |
#include <liboil/globals.h>
|
sl@0
|
25 |
|
sl@0
|
26 |
#define LOG_FILE "c:\\logs\\testsuite_trans8x8_log.txt"
|
sl@0
|
27 |
#include "std_log_result.h"
|
sl@0
|
28 |
#include "utils.h"
|
sl@0
|
29 |
#define LOG_FILENAME_LINE __FILE__, __LINE__
|
sl@0
|
30 |
|
sl@0
|
31 |
#define SIZE 8*8
|
sl@0
|
32 |
|
sl@0
|
33 |
void create_xml(int result)
|
sl@0
|
34 |
{
|
sl@0
|
35 |
if(result)
|
sl@0
|
36 |
assert_failed = 1;
|
sl@0
|
37 |
|
sl@0
|
38 |
testResultXml("testsuite_trans8x8");
|
sl@0
|
39 |
close_log_file();
|
sl@0
|
40 |
}
|
sl@0
|
41 |
|
sl@0
|
42 |
void test_oil_trans8x8_f64()
|
sl@0
|
43 |
{
|
sl@0
|
44 |
//double * d_8x8, int ds, const double * s_8x8, int ss
|
sl@0
|
45 |
double output[SIZE];
|
sl@0
|
46 |
double input[SIZE];
|
sl@0
|
47 |
double linux_output[SIZE] = {77.000000000000000,0.000000000000000,0.000000000000000,0.000000000000000,88.000000000000000,0.000000000000000,0.000000000000000,-2.000000000007314,0.000000000000000,0.000000000000000,0.000000000000000,0.000000000000000,0.000000000000000,0.000000000000000,0.000000000000000,0.000000000000000,0.000000000000000,0.000000000000000,0.000000000000000,0.000000000000000,0.000000000000000,0.000000000000000,0.000000000000000,0.000000000000000,0.000000000000000,0.000000000000000,0.000000000000000,0.000000000000000,0.000000000000000,0.000000000000000,0.000000000000000,0.000000000000000,0.000000000000000,0.000000000000000,0.000000000000000,0.000000000000000,0.000000000000000,0.000000000000000,0.000000000000000,0.000000000000000,0.000000000000000,0.000000000000000,0.000000000000000,0.000000000000000,0.000000000000000,0.000000000000000,0.000000000000000,0.000000000000000,0.000000000000000,0.000000000000000,0.000000000000000,0.000000000000000,0.000000000000000,0.000000000000000,0.000000000000000,0.000000000000000,0.000000000000000,0.000000000000000,0.000000000000000,0.000000000000000,0.000000000000000,0.000000000000000,0.000000000000000,0.000000000000000};
|
sl@0
|
48 |
int i = 0;
|
sl@0
|
49 |
|
sl@0
|
50 |
for(i=0; i<SIZE; i++)
|
sl@0
|
51 |
{
|
sl@0
|
52 |
output[i] = 0;
|
sl@0
|
53 |
input[i] = i+(i*10);
|
sl@0
|
54 |
}
|
sl@0
|
55 |
|
sl@0
|
56 |
oil_trans8x8_f64(output, 0, input, 2);
|
sl@0
|
57 |
|
sl@0
|
58 |
for(i=0; i<SIZE; i++)
|
sl@0
|
59 |
{
|
sl@0
|
60 |
if(comparefloats(output[i], linux_output[i]))
|
sl@0
|
61 |
{
|
sl@0
|
62 |
std_log(LOG_FILENAME_LINE, "output[%d]: expected value - %d, actual value - %d", i,linux_output[i],output[i]);
|
sl@0
|
63 |
assert_failed = 1;
|
sl@0
|
64 |
}
|
sl@0
|
65 |
}
|
sl@0
|
66 |
}
|
sl@0
|
67 |
|
sl@0
|
68 |
void test_oil_trans8x8_u16()
|
sl@0
|
69 |
{
|
sl@0
|
70 |
//uint16_t * d_8x8, int ds, const uint16_t * s_8x8, int ss
|
sl@0
|
71 |
uint16_t output[SIZE];
|
sl@0
|
72 |
uint16_t input[SIZE];
|
sl@0
|
73 |
uint16_t expected_output[SIZE] = {2816,5643,8470,11297,14124,16951,19778,22605,28259,33913,39567,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
|
sl@0
|
74 |
int i = 0;
|
sl@0
|
75 |
|
sl@0
|
76 |
for(i=0; i<SIZE; i++)
|
sl@0
|
77 |
{
|
sl@0
|
78 |
output[i] = 0;
|
sl@0
|
79 |
input[i] = i+(i*10);
|
sl@0
|
80 |
}
|
sl@0
|
81 |
|
sl@0
|
82 |
oil_trans8x8_u16(output, 1, input, 2);
|
sl@0
|
83 |
|
sl@0
|
84 |
for(i=0; i<SIZE; i++)
|
sl@0
|
85 |
{
|
sl@0
|
86 |
if(output[i] != expected_output[i])
|
sl@0
|
87 |
{
|
sl@0
|
88 |
std_log(LOG_FILENAME_LINE, "output[%d]: expected value - %d, actual value - %d", i,expected_output[i],output[i]);
|
sl@0
|
89 |
assert_failed = 1;
|
sl@0
|
90 |
}
|
sl@0
|
91 |
}
|
sl@0
|
92 |
}
|
sl@0
|
93 |
|
sl@0
|
94 |
void test_oil_trans8x8_u32()
|
sl@0
|
95 |
{
|
sl@0
|
96 |
//uint32_t * d_8x8, int ds, const uint32_t * s_8x8, int ss
|
sl@0
|
97 |
uint32_t output[SIZE];
|
sl@0
|
98 |
uint32_t input[SIZE];
|
sl@0
|
99 |
uint32_t linux_output[SIZE] = {555092736,1296185132,0,1476417536,0,1660969728,0,1845521920,0,30976,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
|
sl@0
|
100 |
int i = 0;
|
sl@0
|
101 |
|
sl@0
|
102 |
for(i=0; i<SIZE; i++)
|
sl@0
|
103 |
{
|
sl@0
|
104 |
output[i] = 0;
|
sl@0
|
105 |
input[i] = i+(i*10);
|
sl@0
|
106 |
}
|
sl@0
|
107 |
|
sl@0
|
108 |
oil_trans8x8_u32(output, 1, input, 2);
|
sl@0
|
109 |
|
sl@0
|
110 |
for(i=0; i<SIZE; i++)
|
sl@0
|
111 |
{
|
sl@0
|
112 |
if(output[i] != linux_output[i])
|
sl@0
|
113 |
{
|
sl@0
|
114 |
std_log(LOG_FILENAME_LINE, "output[%d]: expected value - %d, actual value - %d", i,linux_output[i],output[i]);
|
sl@0
|
115 |
assert_failed = 1;
|
sl@0
|
116 |
}
|
sl@0
|
117 |
}
|
sl@0
|
118 |
}
|
sl@0
|
119 |
|
sl@0
|
120 |
void test_oil_trans8x8_u8()
|
sl@0
|
121 |
{
|
sl@0
|
122 |
//uint8_t * d_8x8, int ds, const uint8_t * s_8x8, int ss
|
sl@0
|
123 |
uint8_t output[SIZE];
|
sl@0
|
124 |
uint8_t input[SIZE];
|
sl@0
|
125 |
uint8_t linux_output[SIZE] = {0,11,22,33,44,55,66,77,99,121,143,165,187,209,231,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
|
sl@0
|
126 |
int i = 0;
|
sl@0
|
127 |
|
sl@0
|
128 |
for(i=0; i<SIZE; i++)
|
sl@0
|
129 |
{
|
sl@0
|
130 |
output[i] = 0;
|
sl@0
|
131 |
input[i] = i+(i*10);
|
sl@0
|
132 |
}
|
sl@0
|
133 |
|
sl@0
|
134 |
oil_trans8x8_u8(output, 1, input, 2);
|
sl@0
|
135 |
|
sl@0
|
136 |
for(i=0; i<SIZE; i++)
|
sl@0
|
137 |
{
|
sl@0
|
138 |
if(output[i] != linux_output[i])
|
sl@0
|
139 |
{
|
sl@0
|
140 |
std_log(LOG_FILENAME_LINE, "output[%d]: expected value - %d, actual value - %d", i,linux_output[i],output[i]);
|
sl@0
|
141 |
assert_failed = 1;
|
sl@0
|
142 |
}
|
sl@0
|
143 |
}
|
sl@0
|
144 |
}
|
sl@0
|
145 |
|
sl@0
|
146 |
int main (/*int argc, char *argv[]*/)
|
sl@0
|
147 |
{
|
sl@0
|
148 |
oil_init ();
|
sl@0
|
149 |
|
sl@0
|
150 |
std_log(LOG_FILENAME_LINE,"START oil_trans8x8_u8 TEST");
|
sl@0
|
151 |
test_oil_trans8x8_u8();
|
sl@0
|
152 |
std_log(LOG_FILENAME_LINE,"END TEST\n");
|
sl@0
|
153 |
|
sl@0
|
154 |
std_log(LOG_FILENAME_LINE,"START oil_trans8x8_u16 TEST");
|
sl@0
|
155 |
test_oil_trans8x8_u16(); // getting diff result than linux
|
sl@0
|
156 |
std_log(LOG_FILENAME_LINE,"END TEST\n");
|
sl@0
|
157 |
|
sl@0
|
158 |
std_log(LOG_FILENAME_LINE,"START oil_trans8x8_u32 TEST");
|
sl@0
|
159 |
test_oil_trans8x8_u32();
|
sl@0
|
160 |
std_log(LOG_FILENAME_LINE,"END TEST\n");
|
sl@0
|
161 |
|
sl@0
|
162 |
std_log(LOG_FILENAME_LINE,"START oil_trans8x8_f64 TEST");
|
sl@0
|
163 |
test_oil_trans8x8_f64();
|
sl@0
|
164 |
std_log(LOG_FILENAME_LINE,"END TEST\n");
|
sl@0
|
165 |
|
sl@0
|
166 |
if(assert_failed)
|
sl@0
|
167 |
std_log(LOG_FILENAME_LINE,"Test Failed");
|
sl@0
|
168 |
else
|
sl@0
|
169 |
std_log(LOG_FILENAME_LINE,"Test Successful");
|
sl@0
|
170 |
|
sl@0
|
171 |
create_xml(0);
|
sl@0
|
172 |
return 0;
|
sl@0
|
173 |
}
|
sl@0
|
174 |
|