diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/Makefile.am | 13 | ||||
-rw-r--r-- | test/proto.cc | 44 | ||||
-rw-r--r-- | test/test.cc | 53 |
3 files changed, 110 insertions, 0 deletions
diff --git a/test/Makefile.am b/test/Makefile.am new file mode 100644 index 0000000..8cf4ce5 --- /dev/null +++ b/test/Makefile.am @@ -0,0 +1,13 @@ +# Rules for the test code (use `make check` to execute) +TESTS = proto + +check_PROGRAMS = $(TESTS) + +proto_CXXFLAGS = -DOUTPUT=\"proto\" $(CPPUNIT_CFLAGS) \ + -I$(top_srcdir)/src -I$(top_srcdir)/hugin -DDISABLE_HUGIN +proto_CFLAGS = -DDISABLE_HUGIN +proto_LDFLAGS = $(CPPUNIT_LIBS) +proto_SOURCES = \ + $(top_srcdir)/hugin/hugin.c \ + test.cc \ + proto.cc diff --git a/test/proto.cc b/test/proto.cc new file mode 100644 index 0000000..0cc8da9 --- /dev/null +++ b/test/proto.cc @@ -0,0 +1,44 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/*************************************************************************** + * engine.cc + * + * Fri Nov 29 18:09:02 CET 2013 + * Copyright 2013 Bent Bisballe Nyeng + * deva@aasimon.org + ****************************************************************************/ + +/* + * This file is part of DrumGizmo. + * + * DrumGizmo 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. + * + * DrumGizmo 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 DrumGizmo; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. + */ +#include <cppunit/extensions/HelperMacros.h> + +class test_proto_class : public CppUnit::TestFixture +{ + CPPUNIT_TEST_SUITE(test_proto_class); + CPPUNIT_TEST(test_proto); + CPPUNIT_TEST_SUITE_END(); + +public: + void setUp() {} + void tearDown() {} + void test_proto() { + } +}; + +// Registers the fixture into the 'registry' +CPPUNIT_TEST_SUITE_REGISTRATION(test_proto_class); + diff --git a/test/test.cc b/test/test.cc new file mode 100644 index 0000000..88c72e6 --- /dev/null +++ b/test/test.cc @@ -0,0 +1,53 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/*************************************************************************** + * test.cc + * + * Fri Nov 29 17:45:40 CET 2013 + * Copyright 2013 Bent Bisballe Nyeng + * deva@aasimon.org + ****************************************************************************/ + +/* + * This file is part of DrumGizmo. + * + * DrumGizmo 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. + * + * DrumGizmo 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 DrumGizmo; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. + */ +#include <cppunit/XmlOutputter.h> +#include <cppunit/extensions/TestFactoryRegistry.h> +#include <cppunit/ui/text/TestRunner.h> + +#include <fstream> + +int main(int argc, char* argv[]) +{ + // Get the top level suite from the registry + CppUnit::Test *suite = CppUnit::TestFactoryRegistry::getRegistry().makeTest(); + + // Adds the test to the list of test to run + CppUnit::TextUi::TestRunner runner; + runner.addTest( suite ); + + std::ofstream myfile; + myfile.open("result_"OUTPUT".xml"); + runner.setOutputter(new CppUnit::XmlOutputter(&runner.result(), myfile)); + + // Run the tests. + bool wasSucessful = runner.run(); + + myfile.close(); + + // Return error code 1 if the one of test failed. + return wasSucessful ? 0 : 1; +} |