Code

add cxxtests for marker_loc enum. code depends on the exact values of the enumeration.
authorJohan Engelen <goejendaagh@zonnet.nl>
Sat, 5 Dec 2009 22:30:27 +0000 (23:30 +0100)
committerJohan Engelen <goejendaagh@zonnet.nl>
Sat, 5 Dec 2009 22:30:27 +0000 (23:30 +0100)
build.xml
src/Makefile_insert
src/marker-test.h [new file with mode: 0644]
src/sp-marker-loc.h

index 2606a3210a8a39a5eb4b982361c10d365d94f127..d8c62e5f27333eb7485c32b7e29e3f4ad7c293c0 100644 (file)
--- a/build.xml
+++ b/build.xml
             <include name="color-profile-test.h"/>
             <include name="dir-util-test.h"/>
             <include name="extract-uri-test.h"/>
+            <include name="marker-test.h"/>
             <include name="mod360-test.h"/>
             <include name="preferences-test.h"/>
             <include name="round-test.h"/>
index da49187bacb5dd840bb07828e54ada293a3e9c6c..b32889f65278492e839a2153b9ddd4eb3a3d0d3e 100644 (file)
@@ -271,6 +271,7 @@ CXXTEST_TESTSUITES +=                       \
        $(srcdir)/color-profile-test.h  \
        $(srcdir)/dir-util-test.h       \
        $(srcdir)/extract-uri-test.h    \
+       $(srcdir)/marker-test.h         \
        $(srcdir)/mod360-test.h         \
        $(srcdir)/round-test.h          \
        $(srcdir)/preferences-test.h    \
diff --git a/src/marker-test.h b/src/marker-test.h
new file mode 100644 (file)
index 0000000..5b84dcc
--- /dev/null
@@ -0,0 +1,39 @@
+/** @file
+ * @brief Unit tests for SVG marker handling
+ */
+/* Authors:
+ *   Johan Engelen <goejendaagh@zonnet.nl>
+ *
+ * This file is released into the public domain.
+ */
+
+#include <cxxtest/TestSuite.h>
+
+#include "sp-marker-loc.h"
+
+class MarkerTest : public CxxTest::TestSuite
+{
+public:
+
+    void testMarkerLoc()
+    {
+        // code depends on these *exact* values, so check them here.
+        TS_ASSERT_EQUALS(SP_MARKER_LOC, 0);
+        TS_ASSERT_EQUALS(SP_MARKER_LOC_START, 1);
+        TS_ASSERT_EQUALS(SP_MARKER_LOC_MID, 2);
+        TS_ASSERT_EQUALS(SP_MARKER_LOC_END, 3);
+        TS_ASSERT_EQUALS(SP_MARKER_LOC_QTY, 4);
+    }
+
+};
+
+/*
+  Local Variables:
+  mode:c++
+  c-file-style:"stroustrup"
+  c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
+  indent-tabs-mode:nil
+  fill-column:99
+  End:
+*/
+// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :
index 98cab3746450da5a274243c05fa7f19ab084aa36..b6877e5aacc672d0f515465f53014ae323e270dc 100644 (file)
@@ -5,6 +5,8 @@
  * These enums are to allow us to have 4-element arrays that represent a set of marker locations
  * (all, start, mid, and end).  This allows us to iterate through the array in places where we need
  * to do a process across all of the markers, instead of separate code stanzas for each.
+ *
+ * IMPORTANT:  the code assumes that the locations have the values as written below! so don't change the values!!!
  */
 enum SPMarkerLoc {
     SP_MARKER_LOC = 0,