]> ruin.nu Git - germs.git/commitdiff
some more changes
authorMichael Andreen <harv@ruin.nu>
Thu, 14 Jun 2007 13:55:06 +0000 (13:55 +0000)
committerMichael Andreen <harv@ruin.nu>
Thu, 14 Jun 2007 13:55:06 +0000 (13:55 +0000)
src/CMakeLists.txt
src/test/CMakeLists.txt [new file with mode: 0644]
src/test/exampletest.cpp [new file with mode: 0644]
src/test/geneordertest.cpp [new file with mode: 0644]
src/test/main.cpp [new file with mode: 0644]
src/test/qtmain.cpp [new file with mode: 0644]
test/CMakeLists.txt [deleted file]
test/exampletest.cpp [deleted file]
test/geneordertest.cpp [deleted file]
test/main.cpp [deleted file]
test/qtmain.cpp [deleted file]

index 102a11b6912e2bf6f6f1f79013ec9c1f41445dbd..ce189d80369a9eb60e0261642783b631df11ae43 100644 (file)
@@ -5,6 +5,9 @@ SET(CMAKE_VERBOSE_MAKEFILE OFF)
 ADD_DEFINITIONS(-Wall -O2)
 
 INCLUDE_DIRECTORIES(.)
-ADD_EXECUTABLE(../bin/genesort main.cpp geneorder.cpp)
+ADD_LIBRARY(GeneSort geneorder)
+ADD_EXECUTABLE(../bin/genesort main.cpp)
 
-TARGET_LINK_LIBRARIES(../bin/genesort doublefann)
+TARGET_LINK_LIBRARIES(../bin/genesort doublefann GeneSort)
+
+SUBDIRS(test)
diff --git a/src/test/CMakeLists.txt b/src/test/CMakeLists.txt
new file mode 100644 (file)
index 0000000..fa36e96
--- /dev/null
@@ -0,0 +1,20 @@
+PROJECT(GeneSort)
+
+SET(CMAKE_VERBOSE_MAKEFILE OFF)
+
+ADD_DEFINITIONS(-Wall -O2)
+
+find_package(Qt3 REQUIRED)
+
+INCLUDE_DIRECTORIES(${QT_INCLUDE_DIR})
+link_directories(${QT_LIB_DIR})
+add_definitions(${QT_DEFINITIONS})
+
+SET(TESTSRC geneordertest)
+
+ADD_EXECUTABLE(tester main ${TESTSRC})
+
+ADD_EXECUTABLE(qttester qtmain ${TESTSRC})
+
+TARGET_LINK_LIBRARIES(tester GeneSort cppunit)
+TARGET_LINK_LIBRARIES(qttester GeneSort cppunit qttestrunnerd ${QT_LIBRARIES})
diff --git a/src/test/exampletest.cpp b/src/test/exampletest.cpp
new file mode 100644 (file)
index 0000000..32ad2a3
--- /dev/null
@@ -0,0 +1,75 @@
+#ifndef __GENEORDERTEST_H__
+#define __GENEORDERTEST_H__
+
+#include <cppunit/TestFixture.h>
+#include <cppunit/extensions/HelperMacros.h>
+
+/* 
+ * A test case that is designed to produce
+ * example errors and failures.
+ *
+ */
+
+#define TESTNAME ExampleTest
+
+
+class TESTNAME : public CPPUNIT_NS::TestFixture
+{
+  CPPUNIT_TEST_SUITE( TESTNAME );
+  CPPUNIT_TEST( example );
+  CPPUNIT_TEST( anotherExample );
+  CPPUNIT_TEST( testAdd );
+  CPPUNIT_TEST( testEquals );
+  CPPUNIT_TEST_SUITE_END();
+
+protected:
+
+       double m_value1;
+       double m_value2;
+public:
+
+       void setUp (){
+               m_value1 = 2.0;
+               m_value2 = 3.0;
+       }
+
+protected:
+
+       void example ()
+       {
+               CPPUNIT_ASSERT_DOUBLES_EQUAL (1.0, 1.1, 0.05);
+               CPPUNIT_ASSERT (1 == 0);
+               CPPUNIT_ASSERT (1 == 1);
+       }
+
+       void anotherExample ()
+       {
+               CPPUNIT_ASSERT (1 == 2);
+       }
+
+       void testAdd ()
+       {
+               double result = m_value1 + m_value2;
+               CPPUNIT_ASSERT (result == 6.0);
+       }
+
+       void testEquals ()
+       {
+               std::auto_ptr<long>     l1 (new long (12));
+               std::auto_ptr<long>     l2 (new long (12));
+
+               CPPUNIT_ASSERT_EQUAL (12, 12);
+               CPPUNIT_ASSERT_EQUAL (12L, 12L);
+               CPPUNIT_ASSERT_EQUAL (*l1, *l2);
+
+               CPPUNIT_ASSERT (12L == 12L);
+               CPPUNIT_ASSERT_EQUAL (12, 13);
+               CPPUNIT_ASSERT_DOUBLES_EQUAL (12.0, 11.99, 0.5);
+       }
+};
+
+CPPUNIT_TEST_SUITE_REGISTRATION( TESTNAME );
+
+#undef TESTNAME
+
+#endif
diff --git a/src/test/geneordertest.cpp b/src/test/geneordertest.cpp
new file mode 100644 (file)
index 0000000..cc29694
--- /dev/null
@@ -0,0 +1,39 @@
+#include <cppunit/TestFixture.h>
+#include <cppunit/extensions/HelperMacros.h>
+
+#include <geneorder.h>
+
+/* 
+ * A test case that is designed to produce
+ * example errors and failures.
+ *
+ */
+
+#define TESTNAME GeneOrderTest
+
+
+class TESTNAME : public CPPUNIT_NS::TestFixture
+{
+  CPPUNIT_TEST_SUITE( TESTNAME );
+  CPPUNIT_TEST( testCreate );
+  CPPUNIT_TEST_SUITE_END();
+
+protected:
+
+       double m_value1;
+       double m_value2;
+public:
+
+       void setUp (){
+       }
+
+protected:
+
+       void testCreate (){
+          CPPUNIT_ASSERT (1 == 0);
+       }
+};
+
+CPPUNIT_TEST_SUITE_REGISTRATION( TESTNAME );
+
+#undef TESTNAME
diff --git a/src/test/main.cpp b/src/test/main.cpp
new file mode 100644 (file)
index 0000000..4eca9d0
--- /dev/null
@@ -0,0 +1,34 @@
+#include <cppunit/BriefTestProgressListener.h>
+#include <cppunit/CompilerOutputter.h>
+#include <cppunit/extensions/TestFactoryRegistry.h>
+#include <cppunit/TestResult.h>
+#include <cppunit/TestResultCollector.h>
+#include <cppunit/TestRunner.h>
+
+
+int
+main( int argc, char* argv[] )
+{
+  // Create the event manager and test controller
+  CPPUNIT_NS::TestResult controller;
+
+  // Add a listener that colllects test result
+  CPPUNIT_NS::TestResultCollector result;
+  controller.addListener( &result );        
+
+  // Add a listener that print dots as test run.
+  CPPUNIT_NS::BriefTestProgressListener progress;
+  controller.addListener( &progress );      
+
+  // Add the top suite to the test runner
+  CPPUNIT_NS::TestRunner runner;
+  runner.addTest( CPPUNIT_NS::TestFactoryRegistry::getRegistry().makeTest() );
+  runner.run( controller );
+
+  // Print test in a compiler compatible format.
+  CPPUNIT_NS::CompilerOutputter outputter( &result, CPPUNIT_NS::stdCOut() );
+  outputter.write(); 
+
+  return result.wasSuccessful() ? 0 : 1;
+}
+
diff --git a/src/test/qtmain.cpp b/src/test/qtmain.cpp
new file mode 100644 (file)
index 0000000..e650040
--- /dev/null
@@ -0,0 +1,19 @@
+#include <qapplication.h>
+#include <cppunit/ui/qt/TestRunner.h>
+#include <cppunit/extensions/TestFactoryRegistry.h>
+
+
+int main( int argc, char** argv )
+{
+       QApplication app( argc, argv );
+
+       //CPPUNIT_NS::QtUi::TestRunner runner;
+       
+    CPPUNIT_NS::QtTestRunner runner; 
+               
+       runner.addTest( CPPUNIT_NS::TestFactoryRegistry::getRegistry().makeTest() );
+       runner.run( true );
+
+       return 0;
+}
+
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
deleted file mode 100644 (file)
index 0810962..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-PROJECT(GeneSort)
-
-SET(CMAKE_VERBOSE_MAKEFILE OFF)
-
-ADD_DEFINITIONS(-Wall -O2)
-
-find_package(Qt3 REQUIRED)
-
-INCLUDE_DIRECTORIES(. ../src ${QT_INCLUDE_DIR})
-link_directories(${QT_LIB_DIR})
-add_definitions(${QT_DEFINITIONS})
-
-SET(TESTSRC geneordertest)
-
-ADD_EXECUTABLE(tester main ${TESTSRC})
-
-ADD_EXECUTABLE(qttester qtmain ${TESTSRC})
-
-TARGET_LINK_LIBRARIES(tester cppunit)
-TARGET_LINK_LIBRARIES(qttester cppunit qttestrunnerd ${QT_LIBRARIES})
diff --git a/test/exampletest.cpp b/test/exampletest.cpp
deleted file mode 100644 (file)
index 32ad2a3..0000000
+++ /dev/null
@@ -1,75 +0,0 @@
-#ifndef __GENEORDERTEST_H__
-#define __GENEORDERTEST_H__
-
-#include <cppunit/TestFixture.h>
-#include <cppunit/extensions/HelperMacros.h>
-
-/* 
- * A test case that is designed to produce
- * example errors and failures.
- *
- */
-
-#define TESTNAME ExampleTest
-
-
-class TESTNAME : public CPPUNIT_NS::TestFixture
-{
-  CPPUNIT_TEST_SUITE( TESTNAME );
-  CPPUNIT_TEST( example );
-  CPPUNIT_TEST( anotherExample );
-  CPPUNIT_TEST( testAdd );
-  CPPUNIT_TEST( testEquals );
-  CPPUNIT_TEST_SUITE_END();
-
-protected:
-
-       double m_value1;
-       double m_value2;
-public:
-
-       void setUp (){
-               m_value1 = 2.0;
-               m_value2 = 3.0;
-       }
-
-protected:
-
-       void example ()
-       {
-               CPPUNIT_ASSERT_DOUBLES_EQUAL (1.0, 1.1, 0.05);
-               CPPUNIT_ASSERT (1 == 0);
-               CPPUNIT_ASSERT (1 == 1);
-       }
-
-       void anotherExample ()
-       {
-               CPPUNIT_ASSERT (1 == 2);
-       }
-
-       void testAdd ()
-       {
-               double result = m_value1 + m_value2;
-               CPPUNIT_ASSERT (result == 6.0);
-       }
-
-       void testEquals ()
-       {
-               std::auto_ptr<long>     l1 (new long (12));
-               std::auto_ptr<long>     l2 (new long (12));
-
-               CPPUNIT_ASSERT_EQUAL (12, 12);
-               CPPUNIT_ASSERT_EQUAL (12L, 12L);
-               CPPUNIT_ASSERT_EQUAL (*l1, *l2);
-
-               CPPUNIT_ASSERT (12L == 12L);
-               CPPUNIT_ASSERT_EQUAL (12, 13);
-               CPPUNIT_ASSERT_DOUBLES_EQUAL (12.0, 11.99, 0.5);
-       }
-};
-
-CPPUNIT_TEST_SUITE_REGISTRATION( TESTNAME );
-
-#undef TESTNAME
-
-#endif
diff --git a/test/geneordertest.cpp b/test/geneordertest.cpp
deleted file mode 100644 (file)
index cc29694..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-#include <cppunit/TestFixture.h>
-#include <cppunit/extensions/HelperMacros.h>
-
-#include <geneorder.h>
-
-/* 
- * A test case that is designed to produce
- * example errors and failures.
- *
- */
-
-#define TESTNAME GeneOrderTest
-
-
-class TESTNAME : public CPPUNIT_NS::TestFixture
-{
-  CPPUNIT_TEST_SUITE( TESTNAME );
-  CPPUNIT_TEST( testCreate );
-  CPPUNIT_TEST_SUITE_END();
-
-protected:
-
-       double m_value1;
-       double m_value2;
-public:
-
-       void setUp (){
-       }
-
-protected:
-
-       void testCreate (){
-          CPPUNIT_ASSERT (1 == 0);
-       }
-};
-
-CPPUNIT_TEST_SUITE_REGISTRATION( TESTNAME );
-
-#undef TESTNAME
diff --git a/test/main.cpp b/test/main.cpp
deleted file mode 100644 (file)
index 4eca9d0..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-#include <cppunit/BriefTestProgressListener.h>
-#include <cppunit/CompilerOutputter.h>
-#include <cppunit/extensions/TestFactoryRegistry.h>
-#include <cppunit/TestResult.h>
-#include <cppunit/TestResultCollector.h>
-#include <cppunit/TestRunner.h>
-
-
-int
-main( int argc, char* argv[] )
-{
-  // Create the event manager and test controller
-  CPPUNIT_NS::TestResult controller;
-
-  // Add a listener that colllects test result
-  CPPUNIT_NS::TestResultCollector result;
-  controller.addListener( &result );        
-
-  // Add a listener that print dots as test run.
-  CPPUNIT_NS::BriefTestProgressListener progress;
-  controller.addListener( &progress );      
-
-  // Add the top suite to the test runner
-  CPPUNIT_NS::TestRunner runner;
-  runner.addTest( CPPUNIT_NS::TestFactoryRegistry::getRegistry().makeTest() );
-  runner.run( controller );
-
-  // Print test in a compiler compatible format.
-  CPPUNIT_NS::CompilerOutputter outputter( &result, CPPUNIT_NS::stdCOut() );
-  outputter.write(); 
-
-  return result.wasSuccessful() ? 0 : 1;
-}
-
diff --git a/test/qtmain.cpp b/test/qtmain.cpp
deleted file mode 100644 (file)
index e650040..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-#include <qapplication.h>
-#include <cppunit/ui/qt/TestRunner.h>
-#include <cppunit/extensions/TestFactoryRegistry.h>
-
-
-int main( int argc, char** argv )
-{
-       QApplication app( argc, argv );
-
-       //CPPUNIT_NS::QtUi::TestRunner runner;
-       
-    CPPUNIT_NS::QtTestRunner runner; 
-               
-       runner.addTest( CPPUNIT_NS::TestFactoryRegistry::getRegistry().makeTest() );
-       runner.run( true );
-
-       return 0;
-}
-