From: Simon B. <pi...@us...> - 2004-12-31 22:58:17
|
Update of /cvsroot/libais/libaisutil/test In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14591/test Modified Files: tests.h Added Files: config.cpp test.conf Log Message: Initial updates for the new configuration parser - WILL NOT COMPLETELY BUILD!! Major architectural changes here!! Yes, it's new years -- HAPPY NEW 2005!!! :) --- NEW FILE: config.cpp --- /* $Id: config.cpp,v 1.1 2004/12/31 22:58:07 pickle Exp $ * * Copyright (c) 2004 Alien Internet Services * * This file is a part of LibAISutil. * * LibAISutil is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * LibAISutil is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with LibAISutil; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifdef HAVE_CONFIG_H # include "config.h" #endif #include <aisutil/config/config.h> #include <iostream> #include "tests.h" using namespace AIS::Util; // Table of configuration definitions static Config::defTable_type definitionTable = { { 0, 0, 0, 0, 0, 0 } }; /* Error reporting mechanism. * Due to the very nature of the configuration parser, this is how the tests * are actually monitored. The error responces are synchronised with the * test configuration file and are checked based on correct error responces. */ class TestReporter : public Config::ErrorReporter { private: const bool silent; public: TestReporter(const bool _silent) : silent(_silent) {}; ~TestReporter(void) {}; }; // Configuration class itself class TestConfig : public Config::Config { private: // Test variables bool testBool; signed int testSignedInt; unsigned int testUnsignedInt; signed char testSignedChar; unsigned char testUnsignedChar; signed short testSignedShort; unsigned short testUnsighedShort; signed long testSignedLong; unsigned long testUnsignedLong; public: TestConfig(void) : Config::Config(definitionTable) {}; ~TestConfig(void) {}; }; int main(int argc, char **argv) { TEST_STATUS("Creating local error reporting/tracking mechanism"); TestReporter reporter(TEST_VERBOSE); TEST_STATUS("Creating configuration class"); TestConfig configuration; TEST_END; } --- NEW FILE: test.conf --- /* $Id: test.conf,v 1.1 2004/12/31 22:58:07 pickle Exp $ * * Copyright (c) 2004 Alien Internet Services * * This file is a part of LibAISutil. * * LibAISutil is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * LibAISutil is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with LibAISutil; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ bool = true; bool = false; integers = { } Index: tests.h =================================================================== RCS file: /cvsroot/libais/libaisutil/test/tests.h,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- tests.h 10 Aug 2003 07:24:30 -0000 1.4 +++ tests.h 31 Dec 2004 22:58:07 -0000 1.5 @@ -1,6 +1,6 @@ /* $Id$ * - * Copyright (c) 2003 Alien Internet Services + * Copyright (c) 2003,2004 Alien Internet Services * * This file is a part of LibAISutil. * @@ -25,8 +25,11 @@ #include <iostream> +#define TEST_VERBOSE \ + (argc > 1) + #define TEST_STATUS(x) \ - if (argc > 1) { \ + if (TEST_VERBOSE) { \ std::cout << x << std::endl; \ } |