Initialize libbullet git in 2.0_beta.
[platform/upstream/libbullet.git] / Extras / simdmathlibrary / spu / tests / llabsi2.c
1 /* Test llabsi2 for SPU
2    Copyright (C) 2006, 2007 Sony Computer Entertainment Inc.
3    All rights reserved.
4
5    Redistribution and use in source and binary forms,
6    with or without modification, are permitted provided that the
7    following conditions are met:
8     * Redistributions of source code must retain the above copyright
9       notice, this list of conditions and the following disclaimer.
10     * Redistributions in binary form must reproduce the above copyright
11       notice, this list of conditions and the following disclaimer in the
12       documentation and/or other materials provided with the distribution.
13     * Neither the name of the Sony Computer Entertainment Inc nor the names
14       of its contributors may be used to endorse or promote products derived
15       from this software without specific prior written permission.
16
17    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18    AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19    IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20    ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
21    LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22    CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23    SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24    INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25    CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26    ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27    POSSIBILITY OF SUCH DAMAGE.
28  */
29 /**
30  *
31  *@@ llabsi2 - returns absolute value of input.
32  *
33  *@brief
34  * boundary test for llabsi2.
35  *
36  *@pre
37  *
38  *@criteria
39  * Run this program and check no error will be occurred.
40  *
41  *@note
42  * 
43  *
44  **/
45
46
47 #include <stdio.h>
48 #include <stdlib.h>
49 #include <math.h>
50 //#include <fenv.h>
51 #include <float.h>
52 #include "simdmath.h"
53 #include "common-test.h"
54 #include "testutils.h"
55
56
57 int main()
58 {
59         TEST_SET_START("20060831134500NM","NM", "llabsi2");
60
61         vec_llong2 x0_v = ((vec_llong2){ 0, 0});
62         vec_llong2 r0_v = ((vec_llong2){ 0, 0});
63
64         vec_llong2 x1_v = ((vec_llong2){-1, 1});
65         vec_llong2 r1_v = ((vec_llong2){ 1, 1});
66
67         vec_llong2 x2_v = ((vec_llong2){ 1,-1});
68         vec_llong2 r2_v = ((vec_llong2){ 1, 1});
69         // 0x7FFFFFFFFFFFFFFF
70         vec_llong2 x3_v = ((vec_llong2){ 9223372036854775807LL,-9223372036854775807LL});
71         vec_llong2 r3_v = ((vec_llong2){ 9223372036854775807LL, 9223372036854775807LL});
72         // 0x8000000000000000
73         vec_llong2 x4_v = ((vec_llong2){0x8000000000000000LL,0x8000000000000000LL});
74         vec_llong2 r4_v = ((vec_llong2){0x8000000000000000LL,0x8000000000000000LL});
75
76         vec_llong2  res_v;
77
78    TEST_START("llabsi2");
79    res_v = llabsi2 (x0_v);
80    TEST_CHECK("20060831134501NM", allequal_llong2( res_v, r0_v ), 0);
81    res_v = llabsi2 (x1_v);
82    TEST_CHECK("20060831134502NM", allequal_llong2( res_v, r1_v ), 0);
83    res_v = llabsi2 (x2_v);
84    TEST_CHECK("20060831134503NM", allequal_llong2( res_v, r2_v ), 0);
85    res_v = llabsi2 (x3_v);
86    TEST_CHECK("20060831134504NM", allequal_llong2( res_v, r3_v ), 0);
87    res_v = llabsi2 (x4_v);
88    TEST_CHECK("20060831134505NM", allequal_llong2( res_v, r4_v ), 0);
89
90    TEST_SET_DONE();
91
92    TEST_EXIT();
93
94 }