From 0b073c684fd15710d06a3824a7b003fdfd780d8d Mon Sep 17 00:00:00 2001 From: "Johan B. C. Engelen" Date: Sat, 5 Dec 2009 23:30:27 +0100 Subject: add cxxtests for marker_loc enum. code depends on the exact values of the enumeration. (bzr r8868) --- src/Makefile_insert | 1 + src/marker-test.h | 39 +++++++++++++++++++++++++++++++++++++++ src/sp-marker-loc.h | 2 ++ 3 files changed, 42 insertions(+) create mode 100644 src/marker-test.h (limited to 'src') diff --git a/src/Makefile_insert b/src/Makefile_insert index da49187ba..b32889f65 100644 --- a/src/Makefile_insert +++ b/src/Makefile_insert @@ -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 index 000000000..5b84dcc66 --- /dev/null +++ b/src/marker-test.h @@ -0,0 +1,39 @@ +/** @file + * @brief Unit tests for SVG marker handling + */ +/* Authors: + * Johan Engelen + * + * This file is released into the public domain. + */ + +#include + +#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 : diff --git a/src/sp-marker-loc.h b/src/sp-marker-loc.h index 98cab3746..b6877e5aa 100644 --- a/src/sp-marker-loc.h +++ b/src/sp-marker-loc.h @@ -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, -- cgit v1.2.3