root/trunk/libffado/src/debugmodule/test_debugmodule.cpp

Revision 445, 2.9 kB (checked in by pieterpalmers, 17 years ago)

* name change from FreeBoB to FFADO
* replaced tabs by 4 spaces
* got rid of end-of-line spaces
* made all license and copyrights conform

library becomes LGPL, apps become GPL
explicitly state LGPL v2.1 and GPL v2 (don't like v3 draft)

copyrights are 2005-2007 Daniel & Pieter
except for the MotU stuff (C) Jonathan, Pieter

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1 /*
2  * Copyright (C) 2005-2007 by Daniel Wagner
3  * Copyright (C) 2005-2007 by Pieter Palmers
4  *
5  * This file is part of FFADO
6  * FFADO = Free Firewire (pro-)audio drivers for linux
7  *
8  * FFADO is based upon FreeBoB.
9  *
10  * This is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License version 2
12  * as published by the Free Software Foundation.
13  *
14  * FFADO is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with FFADO; if not, write to the Free Software
21  * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
22  * MA 02111-1307 USA.
23  */
24
25 #include "debugmodule.h"
26
27 #include <iostream>
28
29 using namespace std;
30
31 class Test
32 {
33 public:
34     Test()
35         {}
36     ~Test()
37         {}
38
39     bool run() {
40         cout << "######################" << endl;
41         cout << "### Test arguments ###" << endl;
42         cout << "######################" << endl;
43         debugOutput( DEBUG_LEVEL_NORMAL, "arg0 = %d, arg1 = 0x%08x\n"
44                      , 1, 0xdeedbeef );
45         cout << endl << endl;
46
47
48         cout << "###################" << endl;
49         cout << "### Test levels ###" << endl;
50         cout << "###################" << endl;
51         for ( debug_level_t level = DEBUG_LEVEL_VERBOSE;
52               level >= 0;
53               --level )
54         {
55             DebugModuleManager::instance()->setMgrDebugLevel( "Test", level );
56
57             cout << endl << "*** Debug Level = " << level << endl << endl;
58
59             debugFatal( "fatal text\n" );
60             debugError( "error text\n" );
61             debugWarning( "warning text\n" );
62             debugOutput( DEBUG_LEVEL_NORMAL, "normal output\n" );
63             debugOutput( DEBUG_LEVEL_VERBOSE,  "verbose output\n" );
64             debugFatalShort( "fatal short text\n" );
65             debugErrorShort( "error short text\n" );
66             debugWarningShort( "warning short text\n" );
67             debugOutputShort( DEBUG_LEVEL_NORMAL, "normal short output\n" );
68             debugOutputShort( DEBUG_LEVEL_VERBOSE,  "verbose short output\n" );
69         }
70         cout << endl << endl;
71
72         return true;
73     }
74
75     DECLARE_DEBUG_MODULE;
76 };
77
78 IMPL_DEBUG_MODULE( Test, Test, DEBUG_LEVEL_VERBOSE );
79
80 DECLARE_GLOBAL_DEBUG_MODULE;
81 IMPL_GLOBAL_DEBUG_MODULE( Test, DEBUG_LEVEL_VERBOSE );
82
83 int main( int argc, char** argv )
84 {
85     cout << "#################################" << endl;
86     cout << "### Test global debug module  ###" << endl;
87     cout << "#################################" << endl;
88     debugOutput( DEBUG_LEVEL_NORMAL, "foobar\n" );
89     cout << endl << endl;
90
91     Test test;
92     test.run();
93
94     return 0;
95 }
96
97 /*
98  * Local variables:
99  *  compile-command: "g++ -Wall -g -DDEBUG -o test test.cpp -L. -ldebugmodule"
100  * End:
101  */
102
Note: See TracBrowser for help on using the browser.