1 /*---------------------------------------------------------------------------*
2   Project:  NitroSDK - FX - demos - test
3   File:     fx_test_common.c
4 
5   Copyright 2003-2005 Nintendo. All rights reserved.
6 
7   These coded instructions, statements, and computer programs contain
8   proprietary information of Nintendo of America Inc. and/or Nintendo
9   Company Ltd., and are protected by Federal copyright law. They may
10   not be disclosed to third parties or copied or duplicated in any form,
11   in whole or in part, without the prior written consent of Nintendo.
12 
13   $Log: fx_test_common.c,v $
14   Revision 1.6  2005/02/28 05:26:13  yosizaki
15   do-indent.
16 
17   Revision 1.5  2004/06/08 00:15:16  yada
18   Added '#pragma unused()' for FINALROM.
19 
20   Revision 1.4  2004/04/07 01:27:57  yada
21   Fixed header comment.
22 
23   Revision 1.3  2004/02/05 07:09:02  yasu
24   Changed SDK prefix from iris to nitro.
25 
26   Revision 1.2  2004/01/29 01:35:09  kitani_toshikazu
27   Fixed some bugs for debug build, restored appended test cases.
28 
29   $NoKeywords: $
30   *---------------------------------------------------------------------------*/
31 
32 #ifndef  FX_TEST_COMMON_H_
33 #include "fx_test_common.h"
34 #endif //  FX_TEST_COMMON_H_
35 
36 
37 //------------------------------------------------------------------------------
38 //
MUST_SUCCEED_ASSERT(BOOL exp,int idx)39 void MUST_SUCCEED_ASSERT(BOOL exp, int idx)
40 {
41 #ifdef SDK_FINALROM
42 #pragma unused( idx )
43 #endif
44 
45     if (!exp)
46     {
47         OS_Printf("****** Test Failure *********************\n");
48         OS_Printf("*  Failure in a MUST SUCCEED TEST\n");
49         OS_Printf("*  Check the test code for No.%d \n", idx);
50         OS_Printf("****** Test Failure *********************\n");
51     }
52 }
53 
54 //------------------------------------------------------------------------------
55 //
MUST_FAIL_ASSERT(BOOL exp,int idx)56 void MUST_FAIL_ASSERT(BOOL exp, int idx)
57 {
58 #ifdef SDK_FINALROM
59 #pragma unused( idx )
60 #endif
61 
62     if (exp)
63     {
64         OS_Printf("****** Test Failure *********************\n");
65         OS_Printf("*  Failure in a MUST FAIL TEST\n");
66         OS_Printf("*  Check the test code for No.%d \n", idx);
67         OS_Printf("****** Test Failure *********************\n");
68     }
69 }
70 
71 //------------------------------------------------------------------------------
72 //
print_mtx43(const MtxFx43 * m)73 void print_mtx43(const MtxFx43 *m)
74 {
75     OutDetail("_\n");
76     OutDetail("%f %f %f\n", m->_00 / 4096.0, m->_01 / 4096.0, m->_02 / 4096.0);
77     OutDetail("%f %f %f\n", m->_10 / 4096.0, m->_11 / 4096.0, m->_12 / 4096.0);
78     OutDetail("%f %f %f\n", m->_20 / 4096.0, m->_21 / 4096.0, m->_22 / 4096.0);
79     OutDetail("%f %f %f\n", m->_30 / 4096.0, m->_31 / 4096.0, m->_32 / 4096.0);
80     OutDetail("_\n");
81 }
82 
83 //------------------------------------------------------------------------------
84 // Show details
OutDetail(const char * fmt,...)85 void OutDetail(const char *fmt, ...)
86 {
87 #ifdef  FX_TEST__SHOW_DETAIL
88     va_list vlist;
89 
90     va_start(vlist, fmt);
91     OS_Printf(fmt, vlist);
92     va_end(vlist);
93 #else
94     (void)fmt;
95 #endif
96 }
97