summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 5acd507)
raw | patch | inline | side by side (parent: 5acd507)
author | joncruz <joncruz@users.sourceforge.net> | |
Fri, 28 Apr 2006 16:47:01 +0000 (16:47 +0000) | ||
committer | joncruz <joncruz@users.sourceforge.net> | |
Fri, 28 Apr 2006 16:47:01 +0000 (16:47 +0000) |
ChangeLog | patch | blob | history | |
src/Makefile.am | patch | blob | history | |
src/Makefile_insert | patch | blob | history | |
src/dir-util-test.cpp | [deleted file] | patch | blob | history |
src/dir-util-test.h | [new file with mode: 0644] | patch | blob |
src/extract-uri-test.cpp | [deleted file] | patch | blob | history |
src/extract-uri-test.h | [new file with mode: 0644] | patch | blob |
diff --git a/ChangeLog b/ChangeLog
index 30b8ddbf070520000aa70a6cf6249966d67de370..015854f39d5d52836dd69e3ca05d9efb5c6fff87 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
+2006-04-28 Jon A. Cruz <jon@joncruz.org>
+
+ * src/Makefile_insert, src/Makefile.am, src/dir-util-test.h,
+ src/dir-util-test.cpp, src/extract-uri-test.h,
+ src/extract-uri-test.cpp:
+ Replaced two tests with CxxTest versions.
+
2006-04-28 Jon A. Cruz <jon@joncruz.org>
* src/Makefile_insert, src/MultiPrinter.h, src/verbs.h,
diff --git a/src/Makefile.am b/src/Makefile.am
index b4fd7a56328e8cd70c0514032d2c3ef88155a9a5..1f6bcefab4ef3219d04a5c4b6fd66c06322e01ae 100644 (file)
--- a/src/Makefile.am
+++ b/src/Makefile.am
TESTS = \
test-all$(EXEEXT) \
- dir-util-test$(EXEEXT) \
- extract-uri-test$(EXEEXT) \
mod360-test$(EXEEXT) \
round-test$(EXEEXT) \
sp-gradient-test$(EXEEXT) \
check_PROGRAMS = \
test-all \
- dir-util-test \
- extract-uri-test \
mod360-test \
round-test \
sp-gradient-test \
diff --git a/src/Makefile_insert b/src/Makefile_insert
index a797984e92d59b8996b4f7dab315403c44c1a2d1..00c3be726c040fb70501602d5eed3549d3a15e21 100644 (file)
--- a/src/Makefile_insert
+++ b/src/Makefile_insert
inkview_SOURCES = inkview.cpp $(win32_sources)
inkview_LDADD = $(all_libs)
-dir_util_test_SOURCES = dir-util-test.cpp utest/test-2ary-cases.h
-dir_util_test_LDADD = dir-util.$(OBJEXT) -lglib-2.0
-
mod360_test_SOURCES = mod360-test.cpp
mod360_test_LDADD = libinkpre.a -lglib-2.0
-extract_uri_test_SOURCES = extract-uri-test.cpp
-extract_uri_test_LDADD = libinkpre.a -lglib-2.0
-
round_test_SOURCES = round-test.cpp
round_test_LDADD = libinkpost.a
test_all_includes = \
attributes-test.h \
color-profile-test.h \
+ dir-util-test.h \
+ extract-uri-test.h \
verbs-test.h
diff --git a/src/dir-util-test.cpp b/src/dir-util-test.cpp
--- a/src/dir-util-test.cpp
+++ /dev/null
@@ -1,48 +0,0 @@
-#include "utest/test-2ary-cases.h"
-#include "dir-util.h"
-#include "streq.h"
-
-struct streq_functor {
- bool operator()(char const *a, char const *b)
- {
- return streq(a, b);
- }
-};
-
-static bool
-test_sp_relative_path_from_path()
-{
- utest_start("sp_relative_path_from_path");
- struct Case2<char const *, char const *, char const *> cases[] = {
- {"/foo/bar", "/foo", "bar"},
- {"/foo/barney", "/foo/bar", "/foo/barney"},
- {"/foo/bar/baz", "/foo/", "bar/baz"},
- {"/foo/bar/baz", "/", "foo/bar/baz"},
- {"/foo/bar/baz", "/foo/qux", "/foo/bar/baz"},
- {"/foo", NULL, "/foo"}
- };
- test_2ary_cases<char const *, char const *, char const *, char const *, streq_functor>
- ("sp_relative_path_from_path",
- sp_relative_path_from_path,
- G_N_ELEMENTS(cases), cases);
- return utest_end();
-}
-
-int main()
-{
- return ( test_sp_relative_path_from_path()
- ? EXIT_SUCCESS
- : EXIT_FAILURE );
-}
-
-
-/*
- 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/dir-util-test.h b/src/dir-util-test.h
--- /dev/null
+++ b/src/dir-util-test.h
@@ -0,0 +1,48 @@
+
+#ifndef SEEN_DIR_UTIL_TEST_H
+#define SEEN_DIR_UTIL_TEST_H
+
+#include <cxxtest/TestSuite.h>
+
+#include "dir-util.h"
+
+class DirUtilTest : public CxxTest::TestSuite
+{
+public:
+ void testBase()
+ {
+ char const* cases[][3] = {
+ {"/foo/bar", "/foo", "bar"},
+ {"/foo/barney", "/foo/bar", "/foo/barney"},
+ {"/foo/bar/baz", "/foo/", "bar/baz"},
+ {"/foo/bar/baz", "/", "foo/bar/baz"},
+ {"/foo/bar/baz", "/foo/qux", "/foo/bar/baz"},
+ {"/foo", NULL, "/foo"}
+ };
+
+ for ( size_t i = 0; i < G_N_ELEMENTS(cases); i++ )
+ {
+ char const* result = sp_relative_path_from_path( cases[i][0], cases[i][1] );
+ TS_ASSERT( result );
+ TS_ASSERT( cases[i][2] );
+ if ( result && cases[i][2] )
+ {
+ TS_ASSERT_EQUALS( std::string(result), std::string(cases[i][2]) );
+ }
+ }
+ }
+
+};
+
+#endif // SEEN_DIR_UTIL_TEST_H
+
+/*
+ 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/extract-uri-test.cpp b/src/extract-uri-test.cpp
--- a/src/extract-uri-test.cpp
+++ /dev/null
@@ -1,56 +0,0 @@
-#include <utest/utest.h>
-#include "extract-uri.h"
-#include <string.h>
-#include <glib.h>
-
-struct Case {
- char const *input;
- char const *exp;
-};
-
-static void test_extract_uri_case(Case const &c)
-{
- char * const p = extract_uri(c.input);
- UTEST_TEST(c.input) {
- UTEST_ASSERT( ( p == NULL ) == ( c.exp == NULL ) );
- if (p) {
- UTEST_ASSERT( strcmp(p, c.exp) == 0 );
- }
- }
- g_free(p);
-}
-
-int main(int argc, char *argv[])
-{
- utest_start("extract_uri");
-
- Case const cases[] = {
- { "url(#foo)", "#foo" },
- { "url foo ", "foo" },
- { "url", NULL },
- { "url ", NULL },
- { "url()", NULL },
- { "url ( ) ", NULL },
- { "url foo bar ", "foo bar" }
- };
-
- for(unsigned i = 0; i < G_N_ELEMENTS(cases); ++i) {
- Case const &c = cases[i];
- test_extract_uri_case(c);
- }
-
- return ( utest_end()
- ? EXIT_SUCCESS
- : EXIT_FAILURE );
-}
-
-/*
- 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/extract-uri-test.h b/src/extract-uri-test.h
--- /dev/null
+++ b/src/extract-uri-test.h
@@ -0,0 +1,49 @@
+
+#ifndef SEEN_EXTRACT_URI_TEST_H
+#define SEEN_EXTRACT_URI_TEST_H
+
+#include <cxxtest/TestSuite.h>
+
+#include "extract-uri.h"
+
+class ExtractURITest : public CxxTest::TestSuite
+{
+public:
+ void testBase()
+ {
+ char const* cases[][2] = {
+ { "url(#foo)", "#foo" },
+ { "url foo ", "foo" },
+ { "url", NULL },
+ { "url ", NULL },
+ { "url()", NULL },
+ { "url ( ) ", NULL },
+ { "url foo bar ", "foo bar" }
+ };
+
+ for ( size_t i = 0; i < G_N_ELEMENTS(cases); i++ )
+ {
+ char const* result = extract_uri( cases[i][0] );
+
+ TS_ASSERT_EQUALS( ( result == NULL ), ( cases[i][1] == NULL ) );
+ if ( result )
+ {
+ TS_ASSERT_EQUALS( std::string(result), std::string(cases[i][1]) );
+ }
+ }
+ }
+
+};
+
+#endif // SEEN_EXTRACT_URI_TEST_H
+
+/*
+ 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 :