[cig-commits] r12958 - in cs/cigma/trunk/tests: . libcigma simple

luis at geodynamics.org luis at geodynamics.org
Wed Sep 24 04:10:50 PDT 2008


Author: luis
Date: 2008-09-24 04:10:50 -0700 (Wed, 24 Sep 2008)
New Revision: 12958

Added:
   cs/cigma/trunk/tests/libcigma/
   cs/cigma/trunk/tests/libcigma/DataPathTest.cpp
   cs/cigma/trunk/tests/libcigma/DataPathTest.h
Modified:
   cs/cigma/trunk/tests/Makefile.am
   cs/cigma/trunk/tests/simple/SimpleTest.cpp
   cs/cigma/trunk/tests/simple/SimpleTest.h
   cs/cigma/trunk/tests/test_registry.cpp
Log:
Update unit tests

Modified: cs/cigma/trunk/tests/Makefile.am
===================================================================
--- cs/cigma/trunk/tests/Makefile.am	2008-09-24 11:10:48 UTC (rev 12957)
+++ cs/cigma/trunk/tests/Makefile.am	2008-09-24 11:10:50 UTC (rev 12958)
@@ -13,12 +13,20 @@
 
 cigma_test_SOURCES = $(test_sources)
 
-cigma_test_CXXFLAGS = @CPPUNIT_CFLAGS@
-cigma_test_LDADD = @CPPUNIT_LIBS@
+cigma_test_CXXFLAGS =
+cigma_test_CXXFLAGS += @CPPUNIT_CFLAGS@
+cigma_test_CXXFLAGS += -I$(top_srcdir)/src
 
+cigma_test_LDADD =
+cigma_test_LDADD += @CPPUNIT_LIBS@
+cigma_test_LDADD += $(top_srcdir)/src/libcigma.a
+cigma_test_LDADD += $(BOOST_FILESYSTEM_LIB)
+
 test_sources = \
 	simple/SimpleTest.h \
 	simple/SimpleTest.cpp \
+	libcigma/DataPathTest.h \
+	libcigma/DataPathTest.cpp \
 	test_registry.cpp \
 	main.cpp
 

Added: cs/cigma/trunk/tests/libcigma/DataPathTest.cpp
===================================================================
--- cs/cigma/trunk/tests/libcigma/DataPathTest.cpp	                        (rev 0)
+++ cs/cigma/trunk/tests/libcigma/DataPathTest.cpp	2008-09-24 11:10:50 UTC (rev 12958)
@@ -0,0 +1,39 @@
+#include "DataPathTest.h"
+using namespace libcigma;
+
+#include "DataPath.h"
+#include "Exception.h"
+using namespace cigma;
+
+DataPathTest::DataPathTest() {}
+DataPathTest::~DataPathTest() {}
+
+void DataPathTest::test_data()
+{
+    DataPath p("foo:bar");
+    CPPUNIT_ASSERT(p.filename() == "foo");
+    CPPUNIT_ASSERT(p.location() == "bar");
+}
+
+void DataPathTest::test_edge_cases()
+{
+    DataPath p1("foo");
+    CPPUNIT_ASSERT(p1.filename() == "foo");
+    CPPUNIT_ASSERT(p1.location() == "");
+
+    DataPath p2(":bar");
+    CPPUNIT_ASSERT(p2.filename() == "");
+    CPPUNIT_ASSERT(p2.location() == "bar");
+
+    DataPath p3("foo:");
+    CPPUNIT_ASSERT(p3.filename() == "foo");
+    CPPUNIT_ASSERT(p3.location() == "");
+}
+
+void DataPathTest::test_constructor_exceptions()
+{
+    CPPUNIT_ASSERT_THROW(DataPath("foo:bar:baz"), cigma::Exception);
+    CPPUNIT_ASSERT_THROW(DataPath("foo:baz:"), cigma::Exception);
+    CPPUNIT_ASSERT_THROW(DataPath(":foo:bar"), cigma::Exception);
+}
+

Added: cs/cigma/trunk/tests/libcigma/DataPathTest.h
===================================================================
--- cs/cigma/trunk/tests/libcigma/DataPathTest.h	                        (rev 0)
+++ cs/cigma/trunk/tests/libcigma/DataPathTest.h	2008-09-24 11:10:50 UTC (rev 12958)
@@ -0,0 +1,30 @@
+#ifndef __DATA_PATH_TEST_H__
+#define __DATA_PATH_TEST_H__
+
+#include <cppunit/TestFixture.h>
+#include <cppunit/extensions/HelperMacros.h>
+
+namespace libcigma
+{
+    class DataPathTest : public CPPUNIT_NS::TestFixture
+    {
+        CPPUNIT_TEST_SUITE(DataPathTest);
+        CPPUNIT_TEST(test_data);
+        CPPUNIT_TEST(test_edge_cases);
+        CPPUNIT_TEST(test_constructor_exceptions);
+        CPPUNIT_TEST_SUITE_END();
+
+    public:
+
+        DataPathTest();
+        virtual ~DataPathTest();
+
+        void test_data();
+        void test_edge_cases();
+        void test_constructor_exceptions();
+
+    };
+}
+
+
+#endif

Modified: cs/cigma/trunk/tests/simple/SimpleTest.cpp
===================================================================
--- cs/cigma/trunk/tests/simple/SimpleTest.cpp	2008-09-24 11:10:48 UTC (rev 12957)
+++ cs/cigma/trunk/tests/simple/SimpleTest.cpp	2008-09-24 11:10:50 UTC (rev 12958)
@@ -1,7 +1,5 @@
 #include "SimpleTest.h"
 
-using namespace cigma;
-
 void SimpleTest::testOnePlusOneEqualsTwo()
 {
     CPPUNIT_ASSERT( 1 + 1 == 2 );

Modified: cs/cigma/trunk/tests/simple/SimpleTest.h
===================================================================
--- cs/cigma/trunk/tests/simple/SimpleTest.h	2008-09-24 11:10:48 UTC (rev 12957)
+++ cs/cigma/trunk/tests/simple/SimpleTest.h	2008-09-24 11:10:50 UTC (rev 12958)
@@ -4,21 +4,17 @@
 #include <cppunit/TestFixture.h>
 #include <cppunit/extensions/HelperMacros.h>
 
-namespace cigma{
+class SimpleTest : public CPPUNIT_NS::TestFixture
+{
+    CPPUNIT_TEST_SUITE( SimpleTest );
+    CPPUNIT_TEST( testOnePlusOneEqualsTwo );
+    CPPUNIT_TEST_SUITE_END();
 
-    class SimpleTest : public CPPUNIT_NS::TestFixture
-    {
-        CPPUNIT_TEST_SUITE( SimpleTest );
-        CPPUNIT_TEST( testOnePlusOneEqualsTwo );
-        CPPUNIT_TEST_SUITE_END();
+public:
+    SimpleTest() {}
+    virtual ~SimpleTest() {}
 
-    public:
-        SimpleTest() {}
-        virtual ~SimpleTest() {}
-    
-        void testOnePlusOneEqualsTwo();
-    };
+    void testOnePlusOneEqualsTwo();
+};
 
-}
-
 #endif

Modified: cs/cigma/trunk/tests/test_registry.cpp
===================================================================
--- cs/cigma/trunk/tests/test_registry.cpp	2008-09-24 11:10:48 UTC (rev 12957)
+++ cs/cigma/trunk/tests/test_registry.cpp	2008-09-24 11:10:50 UTC (rev 12958)
@@ -4,5 +4,7 @@
 //
 
 #include <simple/SimpleTest.h>
-CPPUNIT_TEST_SUITE_REGISTRATION(cigma::SimpleTest);
+CPPUNIT_TEST_SUITE_REGISTRATION(SimpleTest);
 
+#include <libcigma/DataPathTest.h>
+CPPUNIT_TEST_SUITE_REGISTRATION(libcigma::DataPathTest);



More information about the cig-commits mailing list