diff options
Diffstat (limited to 'camel/tests')
73 files changed, 0 insertions, 6702 deletions
diff --git a/camel/tests/.cvsignore b/camel/tests/.cvsignore deleted file mode 100644 index fd6b811c68..0000000000 --- a/camel/tests/.cvsignore +++ /dev/null @@ -1,7 +0,0 @@ -.deps -Makefile -Makefile.in -.libs -.deps -*.lo -*.la diff --git a/camel/tests/Makefile.am b/camel/tests/Makefile.am deleted file mode 100644 index e32f2e455f..0000000000 --- a/camel/tests/Makefile.am +++ /dev/null @@ -1,3 +0,0 @@ - -SUBDIRS = lib \ - message folder stream smime misc mime-filter diff --git a/camel/tests/README b/camel/tests/README deleted file mode 100644 index 6815330102..0000000000 --- a/camel/tests/README +++ /dev/null @@ -1,44 +0,0 @@ - -This directory is to contain regression tests that should be run -before committing anything to camel. - -In each subdirectory of tests there is a README containing a -one-line description of each test file. This README must be kept -uptodate. - -To write a new test: copy an existing one and replace the contents. - -See camel-test.h for a number of functions and macros which setup and -define the test environmet, and help provide meaningful messages when -something actually fails. - -All tests have the following options: - -v[vvvv] - verbose. more v's more verbose. 2 v's will give you - a simple test backtrace of any partially failed tests. - No v's give you a simple backtrace of any failed tests. - -q - quiet. Dont print anything, unless there is a SEGV. - -See the other files in lib/* for utility functions that help to -write the tests (object comparison, creation, etc functions). - -Tests may fail and be non-fatal. In this case, you will see "Partial -success" on the result of each test line. To get more information -about the test, run the test manually with a -v command line argument. -The more v's you have the more detail you get (upto about -vvvvv), -generally use -vv to find out which parts of a partially successful -test failed, and where. - -Note that if writing tests, non-fatal tests (bracketed by a -camel_test_nonfatal() and camel_test_fatal() pair) should only be -defined where: 1. The test in question should ideally pass, and 2. The -code has known limitations currently that stop it passing, but -otherwise works for nominal input. - -To debug tests, set a breakpoint on camel_test_fail, which will be -called for any failure, even a non-fatal one. Or set it to -camel_test_break, which will only be called for fatal errors which are -to print to the screen. - - Michael <notzed@helixcode.com> diff --git a/camel/tests/data/gendoc.pl b/camel/tests/data/gendoc.pl deleted file mode 100755 index 732f05a4ed..0000000000 --- a/camel/tests/data/gendoc.pl +++ /dev/null @@ -1,65 +0,0 @@ -#!/usr/bin/perl - -# Generate 'documents' in different encodings, from po files - -if ($#ARGV < 0) { - print "Usage: gendoc.pl pofile pofile ...\n"; - exit 1; -} - -$fmt = "| fmt -u "; - -sub read_msgstr() -{ - my $str = ""; - while (<IN>) { - if (m/^msgstr \"(.*)\"/) { - $str = $1; - if ($str eq "") { - while (<IN>) { - if (m/\"(.*)\"/) { - $str .= $1; - } else { - last; - } - } - } - return $str; - } - } - return ""; -} - -$unknown = "x-unknown-1"; - -foreach $name (@ARGV) { - if ($name =~ m@([^/]*).po$@) { - $poname = $1; - - open IN,"<$name"; - - $header = read_msgstr; - if ($header =~ /Content-Type:.*charset=([-a-zA-Z0-9]*)/i) { - $charset = $1; - } else { - $charset = $unknown++; - } - - print "Building $poname.$charset.txt from $name\n"; - - open OUT,"$fmt > $poname.$charset.txt"; - while (!eof(IN)) { - $msg = read_msgstr; - # de-escape - $msg =~ s/\\n/\n/gso; - $msg =~ s/\\t/\t/gso; - $msg =~ s/\\(.)/$1/gso; - print OUT $msg." "; - } - close OUT; - close IN; - } else { - printf("ignoring $name, probably not intended\n"); - } -} - diff --git a/camel/tests/data/genline.pl b/camel/tests/data/genline.pl deleted file mode 100755 index 99ff43c882..0000000000 --- a/camel/tests/data/genline.pl +++ /dev/null @@ -1,72 +0,0 @@ -#!/usr/bin/perl - -# Generate 'documents' in different encodings, from po files - -if ($#ARGV < 0) { - print "Usage: genline.pl pofile pofile ...\n"; - exit 1; -} - -sub read_msgstr() -{ - my $str = ""; - while (<IN>) { - if (m/^msgstr \"(.*)\"/) { - $str = $1; - if ($str eq "") { - while (<IN>) { - if (m/\"(.*)\"/) { - $str .= $1; - } else { - last; - } - } - } - return $str; - } - } - return ""; -} - -$unknown = "x-unknown-1"; -open OUT, ">test-lines.h"; - -print OUT <<END; -struct _l { - char *type; - char *line; -} test_lines[] = { -END - -foreach $name (@ARGV) { - if ($name =~ m@([^/]*).po$@) { - $poname = $1; - - open IN,"<$name"; - - $header = read_msgstr; - if ($header =~ /Content-Type:.*charset=([-a-zA-Z0-9]*)/i) { - $charset = $1; - } else { - $charset = $unknown++; - } - - while (!eof(IN)) { - $msg = read_msgstr; - if (length($msg) > 60 && length($msg) < 160) { - print OUT "\t{ \"$charset\", \"$msg\" },\n"; - last; - } -# $msg =~ s/\\n/\n/gso; -# $msg =~ s/\\t/\t/gso; -# $msg =~ s/\\(.)/$1/gso; -# print OUT $msg." "; - } - close IN; - } else { - printf("ignoring $name, probably not intended\n"); - } -} - -print OUT "};\n"; -close OUT; diff --git a/camel/tests/data/getaddr.pl b/camel/tests/data/getaddr.pl deleted file mode 100755 index 74a8a81f74..0000000000 --- a/camel/tests/data/getaddr.pl +++ /dev/null @@ -1,32 +0,0 @@ -#!/usr/bin/perl - -# get addresses out of messages - -if ($#ARGV < 0) { - print "Usage: $0 message(s) mbox(es)\n"; - exit 1; -} - -foreach $name (@ARGV) { - open IN,"<$name"; - while (<IN>) { - if (/^From: (.*)/i - || /^To: (.*)/i - || /^Cc: (.*)/i) { - $base = $1; - while (<IN>) { - if (/^\s+(.*)/) { - $base .= " ".$1; - } else { - last; - } - } - $uniq{$base} = 1; - } - } - close IN; -} - -foreach $key (sort keys %uniq) { - print $key."\n"; -} diff --git a/camel/tests/folder/.cvsignore b/camel/tests/folder/.cvsignore deleted file mode 100644 index 26eaf2f7e1..0000000000 --- a/camel/tests/folder/.cvsignore +++ /dev/null @@ -1,21 +0,0 @@ -.deps -Makefile -Makefile.in -.libs -.deps -*.lo -*.la -temp-test -*.bb -*.bbg -*.da -*.gcov -test1 -test2 -test3 -test4 -test5 -test6 -test7 -test8 -test9 diff --git a/camel/tests/folder/Makefile.am b/camel/tests/folder/Makefile.am deleted file mode 100644 index e49fd92a87..0000000000 --- a/camel/tests/folder/Makefile.am +++ /dev/null @@ -1,28 +0,0 @@ - -INCLUDES = \ - -I$(includedir) \ - -I$(top_srcdir) \ - -I$(top_srcdir)/intl \ - -I$(top_srcdir)/e-util \ - -I$(top_srcdir)/camel \ - -I$(top_srcdir)/camel/tests/lib \ - -DG_LOG_DOMAIN=\"evolution-tests\" \ - $(CAMEL_CFLAGS) - -LDADD = \ - $(top_builddir)/camel/libcamel.la \ - $(top_builddir)/e-util/libeutil.la \ - $(top_builddir)/camel/tests/lib/libcameltest.a \ - $(INTLLIBS) \ - $(EVOLUTION_MAIL_LIBS) - -check_PROGRAMS = \ - test1 test2 test3 \ - test4 test5 test6 \ - test7 test8 test9 \ - test10 - -TESTS = test1 test2 test3 \ - test4 test5 test6 \ - test7 test8 test9 \ - test10 diff --git a/camel/tests/folder/README b/camel/tests/folder/README deleted file mode 100644 index 3ab64ecd1c..0000000000 --- a/camel/tests/folder/README +++ /dev/null @@ -1,12 +0,0 @@ - -test1 camel store folder operations (local only) -test2 basic folder operations, local -test3 folder searching and indexing, local -test4 camel store folder operations, IMAP -test5 camel store folder operations, NNTP -test6 basic folder operations, IMAP -test7 basic folder operations, NNTP - -test8 multithreaded folder torture test, local -test9 filtering -test10 multithreaded folder/store object bag torture test diff --git a/camel/tests/folder/test1.c b/camel/tests/folder/test1.c deleted file mode 100644 index c1d3809852..0000000000 --- a/camel/tests/folder/test1.c +++ /dev/null @@ -1,50 +0,0 @@ -/* store testing */ - -#include "camel-test.h" -#include "folders.h" -#include "session.h" - -#include <camel/camel-exception.h> -#include <camel/camel-service.h> -#include <camel/camel-store.h> - -#define ARRAY_LEN(x) (sizeof(x)/sizeof(x[0])) - -static char *local_providers[] = { - "mbox", - "mh", - "maildir" -}; - -int main(int argc, char **argv) -{ - CamelSession *session; - CamelException *ex; - int i; - char *path; - - camel_test_init(argc, argv); - - ex = camel_exception_new(); - - /* clear out any camel-test data */ - system("/bin/rm -rf /tmp/camel-test"); - - session = camel_test_session_new ("/tmp/camel-test"); - - /* todo: cross-check everything with folder_info checks as well */ - /* todo: subscriptions? */ - /* todo: work out how to do imap/pop/nntp tests */ - for (i=0;i<ARRAY_LEN(local_providers);i++) { - path = g_strdup_printf("%s:///tmp/camel-test/%s", local_providers[i], local_providers[i]); - - test_folder_basic(session, path, TRUE, FALSE); - - g_free(path); - } - - camel_object_unref((CamelObject *)session); - camel_exception_free(ex); - - return 0; -} diff --git a/camel/tests/folder/test10.c b/camel/tests/folder/test10.c deleted file mode 100644 index 6ae9d9856d..0000000000 --- a/camel/tests/folder/test10.c +++ /dev/null @@ -1,115 +0,0 @@ -/* threaded folder testing */ - -#include <string.h> - -#include "camel-test.h" -#include "folders.h" -#include "messages.h" -#include "session.h" - -#include <camel/camel-exception.h> -#include <camel/camel-service.h> -#include <camel/camel-store.h> - -#define MAX_LOOP (10000) -#define MAX_THREADS (5) - -#define d(x) - -#ifndef ENABLE_THREADS -int main(int argc, char **argv) -{ - printf("Test %s is only compiled with threads enabled\n", argv[0]); - return 77; -} -#else - -#include <pthread.h> - - -#define ARRAY_LEN(x) (sizeof(x)/sizeof(x[0])) - -static char *local_providers[] = { - "mbox", - "mh", - "maildir" -}; - -static char *path; -static CamelSession *session; -static int testid; - -static void * -worker(void *d) -{ - int i; - CamelException *ex = camel_exception_new(); - CamelStore *store; - CamelFolder *folder; - - for (i=0;i<MAX_LOOP;i++) { - store = camel_session_get_store(session, path, ex); - camel_exception_clear(ex); - folder = camel_store_get_folder(store, "testbox", CAMEL_STORE_FOLDER_CREATE, ex); - camel_exception_clear(ex); - if (testid == 0) { - camel_object_unref(folder); - camel_object_unref(store); - } else { - camel_object_unref(store); - camel_object_unref(folder); - } - } - - camel_exception_free(ex); - - return NULL; -} - -int main(int argc, char **argv) -{ - CamelException *ex; - int i, j; - pthread_t threads[MAX_THREADS]; - - camel_test_init(argc, argv); - - ex = camel_exception_new(); - - /* clear out any camel-test data */ - system("/bin/rm -rf /tmp/camel-test"); - - session = camel_test_session_new ("/tmp/camel-test"); - - for (testid=0;testid<2;testid++) { - if (testid == 0) - camel_test_start("store and folder bag torture test, stacked references"); - else - camel_test_start("store and folder bag torture test, unstacked references"); - - for (j=0;j<ARRAY_LEN(local_providers);j++) { - - camel_test_push("provider %s", local_providers[j]); - path = g_strdup_printf("%s:///tmp/camel-test/%s", local_providers[j], local_providers[j]); - - for (i=0;i<MAX_THREADS;i++) - pthread_create(&threads[i], 0, worker, NULL); - - for (i=0;i<MAX_THREADS;i++) - pthread_join(threads[i], NULL); - - test_free(path); - - camel_test_pull(); - } - - camel_test_end(); - } - - camel_object_unref((CamelObject *)session); - camel_exception_free(ex); - - return 0; -} - -#endif /* ENABLE_THREADS */ diff --git a/camel/tests/folder/test2.c b/camel/tests/folder/test2.c deleted file mode 100644 index 57a449ff59..0000000000 --- a/camel/tests/folder/test2.c +++ /dev/null @@ -1,58 +0,0 @@ -/* folder testing */ - -#include <sys/types.h> -#include <sys/stat.h> -#include <fcntl.h> - -#include "camel-test.h" -#include "messages.h" -#include "folders.h" -#include "session.h" - -#include <camel/camel-exception.h> -#include <camel/camel-service.h> -#include <camel/camel-store.h> - -#include <camel/camel-folder.h> -#include <camel/camel-folder-summary.h> -#include <camel/camel-mime-message.h> - -#define ARRAY_LEN(x) (sizeof(x)/sizeof(x[0])) - -static char *stores[] = { - "mbox:///tmp/camel-test/mbox", - "mh:///tmp/camel-test/mh", - "maildir:///tmp/camel-test/maildir" -}; - -int main(int argc, char **argv) -{ - CamelSession *session; - CamelException *ex; - int i; - - camel_test_init(argc, argv); - - /* clear out any camel-test data */ - system("/bin/rm -rf /tmp/camel-test"); - - ex = camel_exception_new(); - - session = camel_test_session_new ("/tmp/camel-test"); - - /* we iterate over all stores we want to test, with indexing or indexing turned on or off */ - for (i=0;i<ARRAY_LEN(stores);i++) { - char *name = stores[i]; - - test_folder_message_ops(session, name, TRUE, "testbox"); - } - - /* create a pseudo-spool file, and check that */ - creat("/tmp/camel-test/testbox", 0600); - test_folder_message_ops(session, "spool:///tmp/camel-test/testbox", TRUE, "INBOX"); - - check_unref(session, 1); - camel_exception_free(ex); - - return 0; -} diff --git a/camel/tests/folder/test3.c b/camel/tests/folder/test3.c deleted file mode 100644 index 1449821d91..0000000000 --- a/camel/tests/folder/test3.c +++ /dev/null @@ -1,339 +0,0 @@ -/* folder/index testing */ - -#include <gtk/gtk.h> - -#include <string.h> - -#include "camel-test.h" -#include "messages.h" -#include "folders.h" -#include "session.h" - -#include <camel/camel-exception.h> -#include <camel/camel-service.h> -#include <camel/camel-store.h> - -#include <camel/camel-folder.h> -#include <camel/camel-folder-summary.h> -#include <camel/camel-mime-message.h> - -#define ARRAY_LEN(x) (sizeof(x)/sizeof(x[0])) - -static void -test_folder_search_sub(CamelFolder *folder, const char *expr, int expected) -{ - CamelException *ex = camel_exception_new(); - GPtrArray *uids; - GHashTable *hash; - int i; - - uids = camel_folder_search_by_expression(folder, expr, ex); - check(uids != NULL); - check_msg(uids->len == expected, "search %s expected %d got %d", expr, expected, uids->len); - check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex)); - - /* check the uid's are actually unique, too */ - hash = g_hash_table_new(g_str_hash, g_str_equal); - for (i=0;i<uids->len;i++) { - check(g_hash_table_lookup(hash, uids->pdata[i]) == NULL); - g_hash_table_insert(hash, uids->pdata[i], uids->pdata[i]); - } - g_hash_table_destroy(hash); - - camel_folder_search_free(folder, uids); - - camel_exception_free(ex); -} - -static void -test_folder_search(CamelFolder *folder, const char *expr, int expected) -{ - char *matchall; - -#if 0 - /* FIXME: ??? */ - camel_test_nonfatal("most searches require match-all construct"); - push("Testing search: %s", expr); - test_folder_search_sub(folder, expr, expected); - pull(); - camel_test_fatal(); -#endif - - matchall = g_strdup_printf("(match-all %s)", expr); - push("Testing search: %s", matchall); - test_folder_search_sub(folder, matchall, expected); - test_free(matchall); - pull(); -} - -static struct { - int counts[3]; - char *expr; -} searches[] = { - { { 1, 1, 0 }, "(header-matches \"subject\" \"Test1 message99 subject\")" }, - - { { 100, 50, 0 }, "(header-contains \"subject\" \"subject\")" }, - { { 100, 50, 0 }, "(header-contains \"subject\" \"Subject\")" }, - - { { 100, 50, 0 }, "(body-contains \"content\")" }, - { { 100, 50, 0 }, "(body-contains \"Content\")" }, - - { { 0, 0, 0 }, "(user-flag \"every7\")" }, - { { 100/13+1, 50/13+1, 0 }, "(user-flag \"every13\")" }, - { { 1, 1, 0 }, "(= \"7tag1\" (user-tag \"every7\"))" }, - { { 100/11+1, 50/11+1, 0 }, "(= \"11tag\" (user-tag \"every11\"))" }, - - { { 100/13 + 100/17 + 1, 50/13 + 50/17 + 2, 0 }, "(user-flag \"every13\" \"every17\")" }, - { { 100/13 + 100/17 + 1, 50/13 + 50/17 + 2, 0 }, "(or (user-flag \"every13\") (user-flag \"every17\"))" }, - { { 1, 0, 0 }, "(and (user-flag \"every13\") (user-flag \"every17\"))" }, - - { { 0, 0, 0 }, "(and (header-contains \"subject\" \"Test1\") (header-contains \"subject\" \"Test2\"))" }, - /* we get 11 here as the header-contains is a substring match */ - { { 11, 6, 0 }, "(and (header-contains \"subject\" \"Test1\") (header-contains \"subject\" \"subject\"))" }, - { { 1, 1, 0 }, "(and (header-contains \"subject\" \"Test19\") (header-contains \"subject\" \"subject\"))" }, - { { 0, 0, 0 }, "(and (header-contains \"subject\" \"Test191\") (header-contains \"subject\" \"subject\"))" }, - { { 1, 1, 0 }, "(and (header-contains \"subject\" \"Test1\") (header-contains \"subject\" \"message99\"))" }, - - { { 22, 11, 0 }, "(or (header-contains \"subject\" \"Test1\") (header-contains \"subject\" \"Test2\"))" }, - { { 2, 1, 0 }, "(or (header-contains \"subject\" \"Test16\") (header-contains \"subject\" \"Test99\"))" }, - { { 1, 1, 0 }, "(or (header-contains \"subject\" \"Test123\") (header-contains \"subject\" \"Test99\"))" }, - { { 100, 50, 0 }, "(or (header-contains \"subject\" \"Test1\") (header-contains \"subject\" \"subject\"))" }, - { { 11, 6, 0 }, "(or (header-contains \"subject\" \"Test1\") (header-contains \"subject\" \"message99\"))" }, - - /* 72000 is 24*60*100 == half the 'sent date' of the messages */ - { { 100/2, 50/2, 0 }, "(> 72000 (get-sent-date))" }, - { { 100/2-1, 50/2, 0 }, "(< 72000 (get-sent-date))" }, - { { 1, 0, 0 }, "(= 72000 (get-sent-date))" }, - { { 0, 0, 0 }, "(= 72001 (get-sent-date))" }, - - { { (100/2-1)/17+1, (50/2-1)/17+1, 0 }, "(and (user-flag \"every17\") (< 72000 (get-sent-date)))" }, - { { (100/2-1)/17+1, (50/2-1)/17, 0 }, "(and (user-flag \"every17\") (> 72000 (get-sent-date)))" }, - { { (100/2-1)/13+1, (50/2-1)/13+1, 0 }, "(and (user-flag \"every13\") (< 72000 (get-sent-date)))" }, - { { (100/2-1)/13+1, (50/2-1)/13+1, 0 }, "(and (user-flag \"every13\") (> 72000 (get-sent-date)))" }, - - { { 100/2+100/2/17, 50/2+50/2/17, 0 }, "(or (user-flag \"every17\") (< 72000 (get-sent-date)))" }, - { { 100/2+100/2/17+1, 50/2+50/2/17+1, 0 }, "(or (user-flag \"every17\") (> 72000 (get-sent-date)))" }, - { { 100/2+100/2/13, 50/2+50/2/13+1, 0 }, "(or (user-flag \"every13\") (< 72000 (get-sent-date)))" }, - { { 100/2+100/2/13+1, 50/2+50/2/13+1, 0 }, "(or (user-flag \"every13\") (> 72000 (get-sent-date)))" }, -}; - -static void -run_search(CamelFolder *folder, int m) -{ - int i, j = 0; - - check(m == 50 || m == 100 || m == 0); - - /* *shrug* messy, but it'll do */ - if (m==50) - j = 1; - else if (m==0) - j = 2; - - push("performing searches, expected %d", m); - for (i=0;i<ARRAY_LEN(searches);i++) { - push("running search %d: %s", i, searches[i].expr); - test_folder_search(folder, searches[i].expr, searches[i].counts[j]); - pull(); - } - pull(); -} - - -static char *stores[] = { - "mbox:///tmp/camel-test/mbox", - "mh:///tmp/camel-test/mh", - "maildir:///tmp/camel-test/maildir" -}; - -int main(int argc, char **argv) -{ - CamelSession *session; - CamelStore *store; - CamelException *ex; - CamelFolder *folder; - CamelMimeMessage *msg; - int i, j; - int indexed; - GPtrArray *uids; - - gtk_init(&argc, &argv); - camel_test_init(argc, argv); - - ex = camel_exception_new(); - - /* clear out any camel-test data */ - system("/bin/rm -rf /tmp/camel-test"); - - session = camel_test_session_new ("/tmp/camel-test"); - - /* todo: cross-check everything with folder_info checks as well */ - /* todo: work out how to do imap/pop/nntp tests */ - - /* we iterate over all stores we want to test, with indexing or indexing turned on or off */ - for (i=0;i<ARRAY_LEN(stores);i++) { - char *name = stores[i]; - for (indexed = 0;indexed<2;indexed++) { - char *what = g_strdup_printf("folder search: %s (%sindexed)", name, indexed?"":"non-"); - int flags; - - camel_test_start(what); - test_free(what); - - push("getting store"); - store = camel_session_get_store(session, stores[i], ex); - check_msg(!camel_exception_is_set(ex), "getting store: %s", camel_exception_get_description(ex)); - check(store != NULL); - pull(); - - push("creating %sindexed folder", indexed?"":"non-"); - if (indexed) - flags = CAMEL_STORE_FOLDER_CREATE|CAMEL_STORE_FOLDER_BODY_INDEX; - else - flags = CAMEL_STORE_FOLDER_CREATE; - folder = camel_store_get_folder(store, "testbox", flags, ex); - check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex)); - check(folder != NULL); - - /* we need an empty folder for this to work */ - test_folder_counts(folder, 0, 0); - pull(); - - /* append a bunch of messages with specific content */ - push("appending 100 test messages"); - for (j=0;j<100;j++) { - char *content, *subject; - - push("creating test message"); - msg = test_message_create_simple(); - content = g_strdup_printf("data%d content\n", j); - test_message_set_content_simple((CamelMimePart *)msg, 0, "text/plain", - content, strlen(content)); - test_free(content); - subject = g_strdup_printf("Test%d message%d subject", j, 100-j); - camel_mime_message_set_subject(msg, subject); - - camel_mime_message_set_date(msg, j*60*24, 0); - pull(); - - push("appending simple message %d", j); - camel_folder_append_message(folder, msg, NULL, NULL, ex); - check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex)); - pull(); - - test_free(subject); - - check_unref(msg, 1); - } - pull(); - - push("Setting up some flags &c"); - uids = camel_folder_get_uids(folder); - check(uids->len == 100); - for (j=0;j<100;j++) { - char *uid = uids->pdata[j]; - - if ((j/13)*13 == j) { - camel_folder_set_message_user_flag(folder, uid, "every13", TRUE); - } - if ((j/17)*17 == j) { - camel_folder_set_message_user_flag(folder, uid, "every17", TRUE); - } - if ((j/7)*7 == j) { - char *tag = g_strdup_printf("7tag%d", j/7); - camel_folder_set_message_user_tag(folder, uid, "every7", tag); - test_free(tag); - } - if ((j/11)*11 == j) { - camel_folder_set_message_user_tag(folder, uid, "every11", "11tag"); - } - } - camel_folder_free_uids(folder, uids); - pull(); - - camel_test_nonfatal("Index not guaranteed to be accurate before sync: should be fixed eventually"); - push("Search before sync"); - run_search(folder, 100); - pull(); - camel_test_fatal(); - - push("syncing folder, searching"); - camel_folder_sync(folder, FALSE, ex); - run_search(folder, 100); - pull(); - - push("syncing wiht expunge, search"); - camel_folder_sync(folder, TRUE, ex); - run_search(folder, 100); - pull(); - - push("deleting every 2nd message"); - uids = camel_folder_get_uids(folder); - check(uids->len == 100); - for (j=0;j<uids->len;j+=2) { - camel_folder_delete_message(folder, uids->pdata[j]); - } - camel_folder_free_uids(folder, uids); - run_search(folder, 100); - - push("syncing"); - camel_folder_sync(folder, FALSE, ex); - check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex)); - run_search(folder, 100); - pull(); - - push("expunging"); - camel_folder_expunge(folder, ex); - check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex)); - run_search(folder, 50); - pull(); - - pull(); - - push("closing and re-opening folder"); - check_unref(folder, 1); - folder = camel_store_get_folder(store, "testbox", flags&~(CAMEL_STORE_FOLDER_CREATE), ex); - check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex)); - check(folder != NULL); - - push("deleting remaining messages"); - uids = camel_folder_get_uids(folder); - check(uids->len == 50); - for (j=0;j<uids->len;j++) { - camel_folder_delete_message(folder, uids->pdata[j]); - } - camel_folder_free_uids(folder, uids); - run_search(folder, 50); - - push("syncing"); - camel_folder_sync(folder, FALSE, ex); - check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex)); - run_search(folder, 50); - pull(); - - push("expunging"); - camel_folder_expunge(folder, ex); - check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex)); - run_search(folder, 0); - pull(); - - pull(); - - check_unref(folder, 1); - pull(); - - push("deleting test folder, with no messages in it"); - camel_store_delete_folder(store, "testbox", ex); - check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex)); - pull(); - - check_unref(store, 1); - camel_test_end(); - } - } - - check_unref(session, 1); - camel_exception_free(ex); - - return 0; -} diff --git a/camel/tests/folder/test4.c b/camel/tests/folder/test4.c deleted file mode 100644 index e6c58e023d..0000000000 --- a/camel/tests/folder/test4.c +++ /dev/null @@ -1,53 +0,0 @@ -/* store testing, for remote folders */ - -#include "camel-test.h" -#include "folders.h" -#include "session.h" - -#include <camel/camel-exception.h> -#include <camel/camel-service.h> -#include <camel/camel-store.h> - -#define ARRAY_LEN(x) (sizeof(x)/sizeof(x[0])) - -static char *remote_providers[] = { - "IMAP_TEST_URL", -}; - -int main(int argc, char **argv) -{ - CamelSession *session; - CamelException *ex; - int i; - char *path; - - camel_test_init(argc, argv); - - ex = camel_exception_new(); - - /* clear out any camel-test data */ - system("/bin/rm -rf /tmp/camel-test"); - - session = camel_test_session_new ("/tmp/camel-test"); - - /* todo: cross-check everything with folder_info checks as well */ - /* todo: subscriptions? */ - for (i=0;i<ARRAY_LEN(remote_providers);i++) { - path = getenv(remote_providers[i]); - - if (path == NULL) { - printf("Aborted (ignored).\n"); - printf("Set '%s', to re-run test.\n", remote_providers[i]); - /* tells make check to ignore us in the total count */ - _exit(77); - } - /*camel_test_nonfatal("The IMAP code is just rooted");*/ - test_folder_basic(session, path, FALSE, FALSE); - /*camel_test_fatal();*/ - } - - camel_object_unref((CamelObject *)session); - camel_exception_free(ex); - - return 0; -} diff --git a/camel/tests/folder/test5.c b/camel/tests/folder/test5.c deleted file mode 100644 index ccdfb23b23..0000000000 --- a/camel/tests/folder/test5.c +++ /dev/null @@ -1,53 +0,0 @@ -/* store testing, for remote folders */ - -#include "camel-test.h" -#include "folders.h" -#include "session.h" - -#include <camel/camel-exception.h> -#include <camel/camel-service.h> -#include <camel/camel-store.h> - -#define ARRAY_LEN(x) (sizeof(x)/sizeof(x[0])) - -static char *remote_providers[] = { - "NNTP_TEST_URL", -}; - -int main(int argc, char **argv) -{ - CamelSession *session; - CamelException *ex; - int i; - char *path; - - camel_test_init(argc, argv); - - ex = camel_exception_new(); - - /* clear out any camel-test data */ - system("/bin/rm -rf /tmp/camel-test"); - - session = camel_test_session_new ("/tmp/camel-test"); - - /* todo: cross-check everything with folder_info checks as well */ - /* todo: subscriptions? */ - for (i=0;i<ARRAY_LEN(remote_providers);i++) { - path = getenv(remote_providers[i]); - - if (path == NULL) { - printf("Aborted (ignored).\n"); - printf("Set '%s', to re-run test.\n", remote_providers[i]); - /* tells make check to ignore us in the total count */ - _exit(77); - } - camel_test_nonfatal("Not sure how many tests apply to NNTP"); - test_folder_basic(session, path, FALSE, FALSE); - camel_test_fatal(); - } - - camel_object_unref((CamelObject *)session); - camel_exception_free(ex); - - return 0; -} diff --git a/camel/tests/folder/test6.c b/camel/tests/folder/test6.c deleted file mode 100644 index f0fd8a25ee..0000000000 --- a/camel/tests/folder/test6.c +++ /dev/null @@ -1,56 +0,0 @@ -/* folder testing */ - -#include "camel-test.h" -#include "folders.h" -#include "session.h" - -#include <camel/camel-exception.h> -#include <camel/camel-service.h> -#include <camel/camel-store.h> - -#include <camel/camel-folder.h> -#include <camel/camel-folder-summary.h> -#include <camel/camel-mime-message.h> - -#define ARRAY_LEN(x) (sizeof(x)/sizeof(x[0])) - -static char *remote_providers[] = { - "IMAP_TEST_URL", -}; - -int main(int argc, char **argv) -{ - CamelSession *session; - CamelException *ex; - int i; - char *path; - - camel_test_init(argc, argv); - - /* clear out any camel-test data */ - system("/bin/rm -rf /tmp/camel-test"); - - ex = camel_exception_new(); - - session = camel_test_session_new ("/tmp/camel-test"); - - for (i=0;i<ARRAY_LEN(remote_providers);i++) { - path = getenv(remote_providers[i]); - - if (path == NULL) { - printf("Aborted (ignored).\n"); - printf("Set '%s', to re-run test.\n", remote_providers[i]); - /* tells make check to ignore us in the total count */ - _exit(77); - } - /*camel_test_nonfatal("The IMAP code is just rooted");*/ - test_folder_message_ops(session, path, FALSE, "testbox"); - test_folder_message_ops(session, path, FALSE, "INBOX"); - /*camel_test_fatal();*/ - } - - check_unref(session, 1); - camel_exception_free(ex); - - return 0; -} diff --git a/camel/tests/folder/test7.c b/camel/tests/folder/test7.c deleted file mode 100644 index 3dee12916d..0000000000 --- a/camel/tests/folder/test7.c +++ /dev/null @@ -1,55 +0,0 @@ -/* folder testing */ - -#include "camel-test.h" -#include "messages.h" -#include "session.h" - -#include <camel/camel-exception.h> -#include <camel/camel-service.h> -#include <camel/camel-store.h> - -#include <camel/camel-folder.h> -#include <camel/camel-folder-summary.h> -#include <camel/camel-mime-message.h> - -#define ARRAY_LEN(x) (sizeof(x)/sizeof(x[0])) - -static char *remote_providers[] = { - "NNTP_TEST_URL", -}; - -int main(int argc, char **argv) -{ - CamelSession *session; - CamelException *ex; - int i; - char *path; - - camel_test_init(argc, argv); - - /* clear out any camel-test data */ - system("/bin/rm -rf /tmp/camel-test"); - - ex = camel_exception_new(); - - session = camel_test_session_new ("/tmp/camel-test"); - - for (i=0;i<ARRAY_LEN(remote_providers);i++) { - path = getenv(remote_providers[i]); - - if (path == NULL) { - printf("Aborted (ignored).\n"); - printf("Set '%s', to re-run test.\n", remote_providers[i]); - /* tells make check to ignore us in the total count */ - _exit(77); - } - camel_test_nonfatal("Dont know how many tests apply to NNTP"); - test_folder_message_ops(session, path, FALSE, "testbox"); - camel_test_fatal(); - } - - check_unref(session, 1); - camel_exception_free(ex); - - return 0; -} diff --git a/camel/tests/folder/test8.c b/camel/tests/folder/test8.c deleted file mode 100644 index 54fba4dc83..0000000000 --- a/camel/tests/folder/test8.c +++ /dev/null @@ -1,217 +0,0 @@ -/* threaded folder testing */ - -#include <string.h> - -#include "camel-test.h" -#include "folders.h" -#include "messages.h" -#include "session.h" - -#include <camel/camel-exception.h> -#include <camel/camel-service.h> -#include <camel/camel-store.h> - -#define MAX_MESSAGES (100) -#define MAX_THREADS (10) - -#define d(x) - -#ifndef ENABLE_THREADS -int main(int argc, char **argv) -{ - printf("Test %s is only compiled with threads enabled\n", argv[0]); - return 77; -} -#else - -#include <pthread.h> - - -#define ARRAY_LEN(x) (sizeof(x)/sizeof(x[0])) - -static char *local_providers[] = { - "mbox", - "mh", - "maildir" -}; - -static void -test_add_message(CamelFolder *folder, int j) -{ - CamelMimeMessage *msg; - char *content; - char *subject; - CamelException ex; - - camel_exception_init(&ex); - - push("creating message %d\n", j); - msg = test_message_create_simple(); - content = g_strdup_printf("Test message %08x contents\n\n", j); - test_message_set_content_simple((CamelMimePart *)msg, 0, "text/plain", - content, strlen(content)); - test_free(content); - subject = g_strdup_printf("Test message %08x subject", j); - camel_mime_message_set_subject(msg, subject); - pull(); - - push("appending simple message %d", j); - camel_folder_append_message(folder, msg, NULL, NULL, &ex); - check_msg(!camel_exception_is_set(&ex), "%s", camel_exception_get_description(&ex)); - pull(); - - check_unref(msg, 1); -} - -struct _threadinfo { - int id; - CamelFolder *folder; -}; - -static void * -worker(void *d) -{ - struct _threadinfo *info = d; - int i, j, id = info->id; - char *sub, *content; - GPtrArray *res; - CamelException *ex = camel_exception_new(); - CamelMimeMessage *msg; - - /* we add a message, search for it, twiddle some flags, delete it */ - /* and flat out */ - for (i=0;i<MAX_MESSAGES;i++) { - d(printf("Thread %ld message %i\n", pthread_self(), i)); - test_add_message(info->folder, id+i); - - sub = g_strdup_printf("(match-all (header-contains \"subject\" \"message %08x subject\"))", id+i); - - push("searching for message %d\n\tusing: %s", id+i, sub); - res = camel_folder_search_by_expression(info->folder, sub, ex); - check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex)); - check_msg(res->len == 1, "res->len = %d", res->len); - pull(); - - push("getting message '%s'", res->pdata[0]); - msg = camel_folder_get_message(info->folder, (char *)res->pdata[0], ex); - check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex)); - pull(); - - content = g_strdup_printf("Test message %08x contents\n\n", id+i); - push("comparing content '%s': '%s'", res->pdata[0], content); - test_message_compare_content(camel_medium_get_content_object((CamelMedium *)msg), content, strlen(content)); - test_free(content); - pull(); - - push("deleting message, cleanup"); - j=(100.0*rand()/(RAND_MAX+1.0)); - if (j<=70) { - camel_folder_delete_message(info->folder, res->pdata[0]); - } - - camel_folder_search_free(info->folder, res); - res = NULL; - test_free(sub); - - check_unref(msg, 1); - pull(); - - /* about 1-in 100 calls will expunge */ - j=(200.0*rand()/(RAND_MAX+1.0)); - if (j<=2) { - d(printf("Forcing an expuge\n")); - push("expunging folder"); - camel_folder_expunge(info->folder, ex); - check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex)); - pull(); - } - } - - camel_exception_free(ex); - - return info; -} - -int main(int argc, char **argv) -{ - CamelSession *session; - CamelException *ex; - int i, j, index; - char *path; - CamelStore *store; - pthread_t threads[MAX_THREADS]; - struct _threadinfo *info; - CamelFolder *folder; - GPtrArray *uids; - - camel_test_init(argc, argv); - - ex = camel_exception_new(); - - /* clear out any camel-test data */ - system("/bin/rm -rf /tmp/camel-test"); - - session = camel_test_session_new ("/tmp/camel-test"); - - for (j=0;j<ARRAY_LEN(local_providers);j++) { - for (index=0;index<2;index++) { - path = g_strdup_printf("method %s %s", local_providers[j], index?"indexed":"nonindexed"); - camel_test_start(path); - test_free(path); - - push("trying %s index %d", local_providers[j], index); - path = g_strdup_printf("%s:///tmp/camel-test/%s", local_providers[j], local_providers[j]); - store = camel_session_get_store(session, path, ex); - check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex)); - test_free(path); - - if (index == 0) - folder = camel_store_get_folder(store, "testbox", CAMEL_STORE_FOLDER_CREATE, ex); - else - folder = camel_store_get_folder(store, "testbox", - CAMEL_STORE_FOLDER_CREATE|CAMEL_STORE_FOLDER_BODY_INDEX, ex); - check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex)); - - for (i=0;i<MAX_THREADS;i++) { - info = g_malloc(sizeof(*info)); - info->id = i*MAX_MESSAGES; - info->folder = folder; - pthread_create(&threads[i], 0, worker, info); - } - - for (i=0;i<MAX_THREADS;i++) { - pthread_join(threads[i], (void **)&info); - g_free(info); - } - pull(); - - push("deleting remaining messages"); - uids = camel_folder_get_uids(folder); - for (i=0;i<uids->len;i++) { - camel_folder_delete_message(folder, uids->pdata[i]); - } - camel_folder_free_uids(folder, uids); - - camel_folder_expunge(folder, ex); - check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex)); - - check_unref(folder, 1); - - camel_store_delete_folder(store, "testbox", ex); - check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex)); - - check_unref(store, 1); - - pull(); - - camel_test_end(); - } - } - - camel_object_unref((CamelObject *)session); - camel_exception_free(ex); - - return 0; -} - -#endif /* ENABLE_THREADS */ diff --git a/camel/tests/folder/test9.c b/camel/tests/folder/test9.c deleted file mode 100644 index 79d34c76a5..0000000000 --- a/camel/tests/folder/test9.c +++ /dev/null @@ -1,229 +0,0 @@ -/* folder/index testing */ - -#include <string.h> - -#include "camel-test.h" -#include "messages.h" -#include "folders.h" -#include "session.h" - -#include "camel/camel-exception.h" -#include "camel/camel-service.h" -#include "camel/camel-store.h" - -#include "camel/camel-folder.h" -#include "camel/camel-folder-summary.h" -#include "camel/camel-mime-message.h" -#include "camel/camel-filter-driver.h" -#include "camel/camel-stream-fs.h" - -#define ARRAY_LEN(x) (sizeof(x)/sizeof(x[0])) - -struct { - char *name; - CamelFolder *folder; -} mailboxes[] = { - { "INBOX", NULL }, - { "folder1", NULL }, - { "folder2", NULL }, - { "folder3", NULL }, - { "folder4", NULL }, -}; - -struct { - char *name, *match, *action; -} rules[] = { - { "empty1", "(match-all (header-contains \"Frobnitz\"))", "(copy-to \"folder1\")" }, - { "empty2", "(header-contains \"Frobnitz\")", "(copy-to \"folder2\")" }, - { "count11", "(and (header-contains \"subject\" \"Test1\") (header-contains \"subject\" \"subject\"))", "(move-to \"folder3\")" }, - { "empty3", "(and (header-contains \"subject\" \"Test1\") (header-contains \"subject\" \"subject\"))", "(move-to \"folder4\")" }, - { "count1", "(body-contains \"data50\")", "(copy-to \"folder1\")" }, - { "stop", "(body-contains \"data2\")", "(stop)" }, - { "notreached1", "(body-contains \"data2\")", "(move-to \"folder2\")" }, - { "count1", "(body-contains \"data3\")", "(move-to \"folder2\")" }, - { "ustrcasecmp", "(header-matches \"Subject\" \"Test0 message100 subject\")", "(copy-to \"folder2\")" }, -}; - -/* broken match rules */ -struct { - char *name, *match, *action; -} brokens[] = { - { "count1", "(body-contains data50)", "(copy-to \"folder1\")" }, /* non string argument */ - { "count1", "(body-contains-stuff \"data3\")", "(move-to-folder \"folder2\")" }, /* invalid function */ - { "count1", "(or (body-contains \"data3\") (foo))", "(move-to-folder \"folder2\")" }, /* invalid function */ - { "count1", "(or (body-contains \"data3\") (foo)", "(move-to-folder \"folder2\")" }, /* missing ) */ - { "count1", "(and body-contains \"data3\") (foo)", "(move-to-folder \"folder2\")" }, /* missing ( */ - { "count1", "body-contains \"data3\")", "(move-to-folder \"folder2\")" }, /* missing ( */ - { "count1", "body-contains \"data3\"", "(move-to-folder \"folder2\")" }, /* missing ( ) */ - { "count1", "(body-contains \"data3\" ())", "(move-to-folder \"folder2\")" }, /* extra () */ - { "count1", "()", "(move-to-folder \"folder2\")" }, /* invalid () */ - { "count1", "", "(move-to-folder \"folder2\")" }, /* empty */ -}; - -/* broken action rules */ -struct { - char *name, *match, *action; -} brokena[] = { - { "a", "(body-contains \"data2\")", "(body-contains \"help\")" }, /* rule in action */ - { "a", "(body-contains \"data2\")", "(move-to-folder-name \"folder2\")" }, /* unknown function */ - { "a", "(body-contains \"data2\")", "(or (move-to-folder \"folder2\")" }, /* missing ) */ - { "a", "(body-contains \"data2\")", "(or move-to-folder \"folder2\"))" }, /* missing ( */ - { "a", "(body-contains \"data2\")", "move-to-folder \"folder2\")" }, /* missing ( */ - { "a", "(body-contains \"data2\")", "(move-to-folder \"folder2\" ())" }, /* invalid () */ - { "a", "(body-contains \"data2\")", "()" }, /* invalid () */ - { "a", "(body-contains \"data2\")", "" }, /* empty */ -}; - -static CamelFolder *get_folder(CamelFilterDriver *d, const char *uri, void *data, CamelException *ex) -{ - int i; - - for (i=0;i<ARRAY_LEN(mailboxes);i++) - if (!strcmp(mailboxes[i].name, uri)) { - camel_object_ref((CamelObject *)mailboxes[i].folder); - return mailboxes[i].folder; - } - return NULL; -} - -int main(int argc, char **argv) -{ - CamelSession *session; - CamelStore *store; - CamelException *ex; - CamelFolder *folder; - CamelMimeMessage *msg; - int i, j; - CamelStream *mbox; - CamelFilterDriver *driver; - - /*gtk_init(&argc, &argv);*/ - - camel_test_init(argc, argv); - - ex = camel_exception_new(); - - /* clear out any camel-test data */ - system("/bin/rm -rf /tmp/camel-test"); - - camel_test_start("Simple filtering of mbox"); - - session = camel_test_session_new ("/tmp/camel-test"); - - /* todo: cross-check everything with folder_info checks as well */ - /* todo: work out how to do imap/pop/nntp tests */ - - push("getting store"); - store = camel_session_get_store(session, "mbox:///tmp/camel-test/mbox", ex); - check_msg(!camel_exception_is_set(ex), "getting store: %s", camel_exception_get_description(ex)); - check(store != NULL); - pull(); - - push("Creating output folders"); - for (i=0;i<ARRAY_LEN(mailboxes);i++) { - push("creating %s", mailboxes[i].name); - mailboxes[i].folder = folder = camel_store_get_folder(store, mailboxes[i].name, CAMEL_STORE_FOLDER_CREATE, ex); - check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex)); - check(folder != NULL); - - /* we need an empty folder for this to work */ - test_folder_counts(folder, 0, 0); - pull(); - } - pull(); - - /* append a bunch of messages with specific content */ - push("creating 100 test message mbox"); - mbox = camel_stream_fs_new_with_name("/tmp/camel-test/inbox", O_WRONLY|O_CREAT|O_EXCL, 0600); - for (j=0;j<100;j++) { - char *content, *subject; - - push("creating test message"); - msg = test_message_create_simple(); - content = g_strdup_printf("data%d content\n", j); - test_message_set_content_simple((CamelMimePart *)msg, 0, "text/plain", - content, strlen(content)); - test_free(content); - subject = g_strdup_printf("Test%d message%d subject", j, 100-j); - camel_mime_message_set_subject(msg, subject); - - camel_mime_message_set_date(msg, j*60*24, 0); - pull(); - - camel_stream_printf(mbox, "From \n"); - check(camel_data_wrapper_write_to_stream((CamelDataWrapper *)msg, mbox) != -1); -#if 0 - push("appending simple message %d", j); - camel_folder_append_message(folder, msg, NULL, ex); - check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex)); - pull(); -#endif - test_free(subject); - - check_unref(msg, 1); - } - check(camel_stream_close(mbox) != -1); - check_unref(mbox, 1); - pull(); - - push("Building filters"); - driver = camel_filter_driver_new(session); - camel_filter_driver_set_folder_func(driver, get_folder, NULL); - for (i=0;i<ARRAY_LEN(rules);i++) { - camel_filter_driver_add_rule(driver, rules[i].name, rules[i].match, rules[i].action); - } - pull(); - - push("Executing filters"); - camel_filter_driver_set_default_folder(driver, mailboxes[0].folder); - camel_filter_driver_filter_mbox(driver, "/tmp/camel-test/inbox", NULL, ex); - check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex)); - - /* now need to check the folder counts/etc */ - - check_unref(driver, 1); - pull(); - - /* this tests that invalid rules are caught */ - push("Testing broken match rules"); - for (i=0;i<ARRAY_LEN(brokens);i++) { - push("rule %s", brokens[i].match); - driver = camel_filter_driver_new(session); - camel_filter_driver_set_folder_func(driver, get_folder, NULL); - camel_filter_driver_add_rule(driver, brokens[i].name, brokens[i].match, brokens[i].action); - camel_filter_driver_filter_mbox(driver, "/tmp/camel-test/inbox", NULL, ex); - check(camel_exception_is_set(ex)); - camel_exception_clear(ex); - check_unref(driver, 1); - pull(); - } - pull(); - - push("Testing broken action rules"); - for (i=0;i<ARRAY_LEN(brokena);i++) { - push("rule %s", brokena[i].action); - driver = camel_filter_driver_new(session); - camel_filter_driver_set_folder_func(driver, get_folder, NULL); - camel_filter_driver_add_rule(driver, brokena[i].name, brokena[i].match, brokena[i].action); - camel_filter_driver_filter_mbox(driver, "/tmp/camel-test/inbox", NULL, ex); - check(camel_exception_is_set(ex)); - camel_exception_clear(ex); - check_unref(driver, 1); - pull(); - } - pull(); - - - for (i=0;i<ARRAY_LEN(mailboxes);i++) { - check_unref(mailboxes[i].folder, 1); - } - - check_unref(store, 1); - - check_unref(session, 1); - camel_exception_free(ex); - - camel_test_end(); - - return 0; -} diff --git a/camel/tests/lib/.cvsignore b/camel/tests/lib/.cvsignore deleted file mode 100644 index ba98331a6d..0000000000 --- a/camel/tests/lib/.cvsignore +++ /dev/null @@ -1,12 +0,0 @@ -.deps -Makefile -Makefile.in -.libs -.deps -*.lo -*.la -temp-test -*.bb -*.bbg -*.da -*.gcov diff --git a/camel/tests/lib/Makefile.am b/camel/tests/lib/Makefile.am deleted file mode 100644 index 93ec07abd5..0000000000 --- a/camel/tests/lib/Makefile.am +++ /dev/null @@ -1,22 +0,0 @@ - -INCLUDES = \ - -I$(includedir) \ - -I$(top_srcdir) \ - -I$(top_srcdir)/intl \ - -I$(top_srcdir)/e-util \ - -I$(top_srcdir)/camel \ - $(CAMEL_CFLAGS) - -check_LIBRARIES = libcameltest.a - -libcameltest_a_SOURCES = \ - camel-test.c camel-test.h \ - messages.c messages.h \ - addresses.c addresses.h \ - folders.c folders.h \ - session.c session.h \ - streams.c streams.h \ - address-data.h - -libcameltest_a_LIBADD = \ - $(top_builddir)/e-util/libeutil.la diff --git a/camel/tests/lib/address-data.h b/camel/tests/lib/address-data.h deleted file mode 100644 index acecac596a..0000000000 --- a/camel/tests/lib/address-data.h +++ /dev/null @@ -1,93 +0,0 @@ -/* BE WARY of editing this file with emacs. - Otherwise it might be smart and try to re-encode everything, which - you really do not want -*/ - -static struct _a { - int count; - char *addr; - char *utf8; /* the utf8 in this table was generated by camel itself. As a result i'm making the assumption it - was right when it was created. It also depends on the format of ::format(),. which is likely to - change, to handle other bugs ! */ -} test_address[] = { - { 1, "\"=?ISO-8859-1?Q?David_Guti=E9rrez_Magallanes?=\" <david@iiia.csic.es>", "David GutiĂŠrrez Magallanes <david@iiia.csic.es>" }, - { 1, "\"=?iso-8859-1?Q?Jos=E9?= Antonio Milke G.\" <gerencia@ovoplus.com>", "JosĂŠ Antonio Milke G. <gerencia@ovoplus.com>" }, - { 1, "\"=?iso-8859-2?Q?Hi-Fi_Internert_market_=3D_1.Virtu=E1ln=ED_Internetov=E9_H?= =?iso-8859-2?Q?i-Fi_Studio?=\" <hifimarket@atlas.cz>", "Hi-Fi Internert market = 1.VirtuĂĄlnĂ InternetovĂŠ Hi-Fi Studio <hifimarket@atlas.cz>" }, - { 3, "\"James M. Cape\" <jcape@jcinteractive.com>, =?iso-8859-1?Q?Joaqu=EDn_Cuenca_Abela?= <cuenca@ie2.u-psud.fr>, gnome-hackers@nuclecu.unam.mx", "James M. Cape <jcape@jcinteractive.com>, JoaquĂn Cuenca Abela <cuenca@ie2.u-psud.fr>, gnome-hackers@nuclecu.unam.mx" }, - { 1, "=?ISO-8859-1?Q?David_Guti=E9rrez_Magallanes?= <david@iiia.csic.es>", "David GutiĂŠrrez Magallanes <david@iiia.csic.es>" }, - { 1, "=?ISO-8859-2?Q?Tomasz_K=B3oczko?= <kloczek@rudy.mif.pg.gda.pl>", "Tomasz KĹoczko <kloczek@rudy.mif.pg.gda.pl>" }, - { 1, "=?ISO-8859-2?Q?Vladim=EDr_Solnick=FD?= <vs@utia.cas.cz>", "VladimĂr SolnickĂ˝ <vs@utia.cas.cz>" }, - { 1, "=?iso-8859-1?Q?=22S=F6rensen=2C_Daniel=22?= <dasar@wmdata.com>", "\"SĂśrensen, Daniel\" <dasar@wmdata.com>" }, - { 1, "=?iso-8859-1?Q?=C1=C2=AAQ=A7=CA?= <dennys@iim.nctu.edu.tw>", "ĂĂÂŞQ§à <dennys@iim.nctu.edu.tw>" }, - { 1, "=?iso-8859-1?Q?=C1=C2=AAQ=A7=CA?= <dennys@news.iim.nctu.edu.tw>", "ĂĂÂŞQ§à <dennys@news.iim.nctu.edu.tw>" }, - { 1, "=?iso-8859-1?Q?=C1kos?= Valentinyi <A.Valentinyi@soton.ac.uk>", "Ăkos Valentinyi <A.Valentinyi@soton.ac.uk>" }, - { 1, "=?iso-8859-1?Q?Joaqu=EDn?= Cuenca Abela <cuenca@ie2.u-psud.fr>", "JoaquĂn Cuenca Abela <cuenca@ie2.u-psud.fr>" }, - { 2, "=?iso-8859-1?Q?Joaqu=EDn?= Cuenca Abela <cuenca@ie2.u-psud.fr>, gnome-hackers@nuclecu.unam.mx", "JoaquĂn Cuenca Abela <cuenca@ie2.u-psud.fr>, gnome-hackers@nuclecu.unam.mx" }, - { 1, "=?iso-8859-1?Q?Joaqu=EDn_Cuenca_Abela?= <cuenca@celium.net>", "JoaquĂn Cuenca Abela <cuenca@celium.net>" }, - { 1, "=?iso-8859-1?Q?Juantom=E1s=20Garc=EDa?= <juantomas@lared.es>", "JuantomĂĄs GarcĂa <juantomas@lared.es>" }, - { 1, "=?iso-8859-1?Q?Kenneth_ll=E9phaane_Christiansen?= <kenneth@ripen.dk>", "Kenneth llĂŠphaane Christiansen <kenneth@ripen.dk>" }, - { 1, "=?iso-8859-1?Q?Kjell_Tage_=D8hman?= <tage@ohman.no>", "Kjell Tage Ăhman <tage@ohman.no>" }, - { 1, "=?iso-8859-1?Q?Martin_Norb=E4ck?= <d95mback@dtek.chalmers.se>", "Martin Norbäck <d95mback@dtek.chalmers.se>" }, - { 1, "=?iso-8859-1?Q?P=E5llen?= <pollen@astrakan.hig.se>", "PĂĽllen <pollen@astrakan.hig.se>" }, - { 1, "=?iso-8859-1?Q?Ville_P=E4tsi?= <drc@gnu.org>", "Ville Pätsi <drc@gnu.org>" }, - { 1, "=?iso-8859-1?q?Joaqu=EDn?= Cuenca Abela <cuenca@celium.net>", "JoaquĂn Cuenca Abela <cuenca@celium.net>" }, - { 1, "=?iso-8859-2?Q?Dra=BEen_Ka=E8ar?= <dave@srce.hr>", "DraĹžen KaÄar <dave@srce.hr>" }, - /* yep this is right, this isn't valid so doesn't decode at all */ - { 1, "=?windows-1250?Q? \"Jaka Mo=E8nik\" ?= <jaka.mocnik@kiss.uni-lj.si>", "=?windows-1250?Q? Jaka Mo=E8nik ?= <jaka.mocnik@kiss.uni-lj.si>" }, - { 3, "George <jirka@5z.com>, Juantomas =?ISO-8859-1?Q?Garc=C3=83=C2=ADa?= <juantomas@lared.es>, gnome-hackers@gnome.org", "George <jirka@5z.com>, Juantomas GarcĂÂĂÂa <juantomas@lared.es>, gnome-hackers@gnome.org" }, - { 7, "Jon Trowbridge <trow@emccta.com>, gnome-1.4-list@gnome.org, gnome-devel-list@gnome.org, gnome-hackers@gnome.org, Dom Lachowicz <cinamod@hotmail.com>, =?iso-8859-1?Q?Joaqu=EDn_Cuenca_Abela?= <cuenca@celium.net>, sam th <sam@uchicago.edu>", "Jon Trowbridge <trow@emccta.com>, gnome-1.4-list@gnome.org, gnome-devel-list@gnome.org, gnome-hackers@gnome.org, Dom Lachowicz <cinamod@hotmail.com>, JoaquĂn Cuenca Abela <cuenca@celium.net>, sam th <sam@uchicago.edu>" }, - { 6, "Jon Trowbridge <trow@emccta.com>, gnome-1.4-list@gnome.org, gnome-devel-list@gnome.org, gnome-hackers@gnome.org, Dom Lachowicz <cinamod@hotmail.com>, =?iso-8859-1?Q?Joaqu=EDn_Cuenca_Abela?= <cuenca@ie2.u-psud.fr>", "Jon Trowbridge <trow@emccta.com>, gnome-1.4-list@gnome.org, gnome-devel-list@gnome.org, gnome-hackers@gnome.org, Dom Lachowicz <cinamod@hotmail.com>, JoaquĂn Cuenca Abela <cuenca@ie2.u-psud.fr>" }, - { 1, "Kai =?iso-8859-1?Q?Gro=DFjohann?= <Kai.Grossjohann@CS.Uni-Dortmund.DE>", "Kai GroĂjohann <Kai.Grossjohann@CS.Uni-Dortmund.DE>" }, - { 1, "Kai.Grossjohann@CS.Uni-Dortmund.DE (Kai =?iso-8859-1?q?Gro=DFjohann?=)", "Kai GroĂjohann <Kai.Grossjohann@CS.Uni-Dortmund.DE>" }, - { 1, "Rickard =?iso-8859-1?Q?Nordstr=F6m?= <rzi@ebox.tninet.se>", "Rickard NordstrĂśm <rzi@ebox.tninet.se>" }, - { 1, "Tomasz =?iso-8859-2?q?K=B3oczko?= <kloczek@rudy.mif.pg.gda.pl>", "Tomasz KĹoczko <kloczek@rudy.mif.pg.gda.pl>" }, - { 1, "VALCKE =?iso-8859-1?Q?C=E9dric?= <cvalcke@freesurf.fr>", "VALCKE CĂŠdric <cvalcke@freesurf.fr>" }, - { 1, "Ville =?iso-8859-1?q?P=E4tsi?= <drc@gnu.org>", "Ville Pätsi <drc@gnu.org>" }, - { 1, "david@iiia.csic.es (=?ISO-8859-1?Q?David_Guti=E9rrez_Magallanes?=)", "David GutiĂŠrrez Magallanes <david@iiia.csic.es>" }, - { 1, "kloczek@rudy.mif.pg.gda.pl (=?ISO-8859-2?Q?Tomasz_K=B3oczko?=)", "Tomasz KĹoczko <kloczek@rudy.mif.pg.gda.pl>" }, - { 1, "lassehp@imv.aau.dk (Lasse =?ISO-8859-1?Q?Hiller=F8e?= Petersen)", "Lasse Hillerøe Petersen <lassehp@imv.aau.dk>" }, - { 1, "ysato@etl.go.jp (Yutaka Sato =?ISO-2022-JP?B?GyRAOjRGI0stGyhK?=)", "Yutaka Sato ä˝č¤čą <ysato@etl.go.jp>" }, -}; - -static struct _l { - char *type; - char *line; -} test_lines[] = { - /* commented out unsupported charsets - FIXME: camel should somehow handle this, although it can't really of course */ - /*{ "windows-1251", "Ĺäčí ŕďëĺň íĺ îňăîâŕđ˙ íŕ çŕ˙âęŕ çŕ çŕďčń.\nÄŕ ăî ďđĺěŕőíŕ ëč čëč äŕ ďî÷ŕęŕě?" },*/ - { "iso-8859-1", "Omple les miniatures de la finestra amb contingut de la pantalla" }, - { "ISO-8859-2", "Správce oken hýbe s okrajem okna\n(AfterStep, Enlightenment, FVWM, IceWM, Sawmill)" }, - { "ISO-8859-1", "Vindueshĺndtering flytter dekorationsvindue istedet\n(AfterStep, Enlightenment, FVWM, IceWM, Sawfish)" }, - { "ISO-8859-1", "Vorschaubilder der Fenster mit dem Bildschirminhalt ausfüllen" }, - { "iso-8859-7", "ĹěöÜíéóç ĺńăáóéţí đďő äĺ öáßíďíôáé óôç ëßóôá đáńáčýńůí (ĐÁŃÁĘÁĚŘÇ-ËÉÓÔÁĐÁŃÁČŐŃŮÍ)" }, - { "iso-8859-1", "You've chosen to disable the startup hint.\nTo re-enable it, choose \"Startup Hint\"\nin the GNOME Control Centre" }, - { "iso-8859-1", "El aplique de reloj muestra en su panel la fecha y la hora de forma simple \ny ligero " }, - { "iso-8859-1", "Applet ei vasta salvestuskäsule.\nKas peaks ta niisama sulgema, vői veel ootama?" }, - { "iso-8859-1", "Lehio kudeatzaileak lehioaren dekorazaioa mugiarazten\n(AfterStep, Enlightenment, FVWM, IceWM, Sawmill)" }, - { "iso-8859-15", "Näytä sovellukset, joiden ikkunoista on näkyvillä vain otsikkopalkki" }, - { "ISO-8859-1", "Afficher les tâches qui ne sont pas dans la liste des fenętres" }, - { "iso-8859-1", "Níl applet ag tabhair freagra ar iarratas sábháil.\nBain amach an applet nó lean ar fánacht?" }, - { "iso-8859-1", "Amosa-las tarefas agochadas da lista de fiestras (SKIP-WINLIST)" }, - { "iso-8859-2", "Az ablakkezelő a dekorációt mozgassa az ablak helyett\n(AfterStep, Enlightenment, FVWM, IceWM, SawMill)" }, - { "iso-8859-1", "Riempi la finestra delle anteprime con il contenuto dello schermo" }, - { "euc-jp", "ĽŚĽ¤ĽóĽÉĽŚĽŢĽÍĄźĽ¸Ľă¤Ďžţ¤ęĽŚĽ¤ĽóĽÉĽŚ¤ňĆ°¤Ť¤š\n(AfterStep, Enlightenment, FVWM, IceWM, Sawfish)" }, - { "euc-kr", "â °ü¸ŽŔÚ°Ą ˛ŮšÎ â ´ë˝Ĺ ŔĚľż\n(AfterStep, Enlightenment, FVWM, IceWM, Sawmill)" }, - { "iso-8859-13", "Priedas neatsakinëja á prađymŕ iđsisaugoti.\nPađalinti priedŕ ar laukti toliau?" }, - { "iso-8859-1", "Window manager verplaatst dekoratie\n(AfterStep, Enlightenment, FVWM, IceWM, Sawmill)" }, - { "iso-8859-1", "Vindushĺndtereren flytter dekorasjonsvinduet i stedet\n(AfterStep, Enlightenment, FVWM, IceWM, Sawfish)" }, - { "iso-8859-2", "Przemieszczanie dekoracji zamiast okna\n(AfterStep, Enlightenment, FVWM, IceWM, Sawmill)" }, - { "iso-8859-1", "Este programa é responsável por executar outras aplicaçőes, embeber pequenos applets, a paz no mundo e crashes aleatórios do X." }, - { "iso-8859-1", "Mostrar tarefas que se escondem da lista de janelas (SKIP-WINLIST)" }, - { "koi8-r", "÷ŮÓĎÔÁ ŇÁÂĎŢĹÇĎ ÓÔĎĚÁ × ĐĹŇĹËĚŔŢÁÔĹĚĹ ÓĎ×ĐÁÄÁĹÔ Ó ×ŮÓĎÔĎĘ ĐÁÎĹĚÉ" }, - { "iso-8859-2", "Správca okien presúva okraje okien\n(AfterStep, Enlightenment, FVWM, IceWM, Sawfish)" }, - { "iso-8859-2", "Kaži posle, ki se skrivajo pred upravljalnik oken (SKIP-WINLIST)" }, - { "iso-8859-5", "Window ÜŐÝĐÔ×ŐŕŘ ßŢÜŐŕĐ ÔŐÚŢŕĐćŘŢÝŘ ßŕŢ×Ţŕ ăÜŐáâŢ âŢÓa\n(AfterStep, Enlightenment, FVWM, IceWM, Sawmill)" }, - { "iso-8859-2", "Window menadzeri pomera dekoracioni prozor umesto toga\n(AfterStep, Enlightenment, FVWM, IceWM, Sawmill)" }, - { "iso-8859-1", "Fönsterhanteraren flyttar dekorationsfönstret istället\n(AfterStep, Enlightenment, FVWM, IceWM, Sawfish)" }, - /*{ "TSCII", "Ŕ˝˘ě¸źî-şđź¸ňž˘ř ŔĄ÷ě¸ ÓĘÂĄž Ŕ˝˘ě¸źí¸¨Ç ¸ĄÁ˘ (Ŕ˝˘ě¸źî-şđź¸ő-žĹ˘÷)" },*/ - { "iso-8859-9", "Kaydetme isteđine bir uygulak cevap vermiyor .\nUygulađý sileyim mi , yoksa bekleyeyim mi ?" }, - { "koi8-u", "đĹŇĹÍŚÝĹÎÎŃ ÄĹËĎŇÁĂŚ§ ÚÁÍŚÓÔŘ ×ŚËÎÁ\n(AfterStep, Enlightenment, FVWM, IceWM, Sawfish)" }, - { "iso-8859-1", "Cwand on scriftôr est bodjî foű, li scriftôr čt totes\nles apliketes ĺ dvins sont pierdowes. Bodjî ci scriftôr chal?" }, - { "gb2312", "ǨŇĆľ˝×°Ęδ°żÚšÜŔíłĚĐň(AfterStep, Enlightenment, FVWM, IceWM, SawMill)" }, - { "big5", "ľřľĄşŢ˛zŞĚĽu˛ž°Ę¸Ëš˘ľřľĄ\n(AfterStep, Enlightenment, FVWM, IceWM, Sawmill)" }, -}; diff --git a/camel/tests/lib/addresses.c b/camel/tests/lib/addresses.c deleted file mode 100644 index 57275511c4..0000000000 --- a/camel/tests/lib/addresses.c +++ /dev/null @@ -1,54 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ - -#include <string.h> - -#include "addresses.h" -#include "camel-test.h" - -void -test_address_compare(CamelInternetAddress *addr, CamelInternetAddress *addr2) -{ - const char *r1, *r2, *a1, *a2; - char *e1, *e2, *f1, *f2; - int j; - - check(camel_address_length(CAMEL_ADDRESS(addr)) == camel_address_length(CAMEL_ADDRESS(addr2))); - for (j=0;j<camel_address_length(CAMEL_ADDRESS(addr));j++) { - - check(camel_internet_address_get(addr, j, &r1, &a1) == TRUE); - check(camel_internet_address_get(addr2, j, &r2, &a2) == TRUE); - - check(string_equal(r1, r2)); - check(strcmp(a1, a2) == 0); - } - check(camel_internet_address_get(addr, j, &r1, &a1) == FALSE); - check(camel_internet_address_get(addr2, j, &r2, &a2) == FALSE); - - e1 = camel_address_encode(CAMEL_ADDRESS(addr)); - e2 = camel_address_encode(CAMEL_ADDRESS(addr2)); - - if (camel_address_length(CAMEL_ADDRESS(addr)) == 0) - check(e1 == NULL && e2 == NULL); - else - check(e1 != NULL && e2 != NULL); - - if (e1 != NULL) { - check_msg(string_equal(e1, e2), "e1 = '%s' e2 = '%s'", e1, e2); - test_free(e1); - test_free(e2); - } - - f1 = camel_address_format(CAMEL_ADDRESS(addr)); - f2 = camel_address_format(CAMEL_ADDRESS(addr2)); - - if (camel_address_length(CAMEL_ADDRESS(addr)) == 0) - check(f1 == NULL && f2 == NULL); - else - check(f1 != NULL && f2 != NULL); - - if (f1 != NULL) { - check_msg(string_equal(f1, f2), "f1 = '%s' f2 = '%s'", f1, f2); - test_free(f1); - test_free(f2); - } -} diff --git a/camel/tests/lib/addresses.h b/camel/tests/lib/addresses.h deleted file mode 100644 index dc35a19f05..0000000000 --- a/camel/tests/lib/addresses.h +++ /dev/null @@ -1,5 +0,0 @@ - -#include <camel/camel-internet-address.h> - -/* addresses.c */ -void test_address_compare(CamelInternetAddress *addr, CamelInternetAddress *addr2); diff --git a/camel/tests/lib/camel-test.c b/camel/tests/lib/camel-test.c deleted file mode 100644 index 76385ec696..0000000000 --- a/camel/tests/lib/camel-test.c +++ /dev/null @@ -1,367 +0,0 @@ - -#include "camel-test.h" - -#include <stdio.h> -#include <string.h> -#include <sys/stat.h> -#include <sys/types.h> -#include <unistd.h> -#include <signal.h> -#include <errno.h> - -#ifdef ENABLE_THREADS -#include <pthread.h> -#endif - -#include <camel/camel.h> - -#ifdef ENABLE_THREADS -/* well i dunno, doesn't seem to be in the headers but hte manpage mentions it */ -/* a nonportable checking mutex for glibc, not really needed, just validates - the test harness really */ -# ifdef PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP -static pthread_mutex_t lock = PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP; -# else -static pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER; -# endif -#define CAMEL_TEST_LOCK pthread_mutex_lock(&lock) -#define CAMEL_TEST_UNLOCK pthread_mutex_unlock(&lock) -#define CAMEL_TEST_ID (pthread_self()) -#else -#define CAMEL_TEST_LOCK -#define CAMEL_TEST_UNLOCK -#define CAMEL_TEST_ID (0) -#endif - -static int setup; -static int ok; - -struct _stack { - struct _stack *next; - int fatal; - char *what; -}; - -/* per-thread state */ -struct _state { - char *test; - int nonfatal; - struct _stack *state; -}; - -static GHashTable *info_table; - -int camel_test_verbose; - -static void -dump_action(int id, struct _state *s, void *d) -{ - struct _stack *node; - -#ifdef ENABLE_THREADS - printf("\nThread %d:\n", id); -#endif - node = s->state; - if (node) { - printf("Current action:\n"); - while (node) { - printf("\t%s%s\n", node->fatal?"":"[nonfatal]", node->what); - node = node->next; - } - } - printf("\tTest: %s\n", s->test); -} - -static void die(int sig) -{ - static int indie = 0; - - if (!indie) { - indie = 1; - printf("\n\nReceived fatal signal %d\n", sig); - g_hash_table_foreach(info_table, (GHFunc)dump_action, 0); - -#ifdef ENABLE_THREADS - if (camel_test_verbose > 2) { - printf("Attach debugger to pid %d to debug\n", getpid()); - sleep(1000); - } -#endif - } - - _exit(1); -} - -static struct _state * -current_state(void) -{ - struct _state *info; - - if (info_table == NULL) - info_table = g_hash_table_new(0, 0); - - info = g_hash_table_lookup(info_table, (void *)CAMEL_TEST_ID); - if (info == NULL) { - info = g_malloc0(sizeof(*info)); - g_hash_table_insert(info_table, (void *)CAMEL_TEST_ID, info); - } - return info; -} - - -void camel_test_init(int argc, char **argv) -{ - struct stat st; - char *path; - int i; - - setup = 1; - - /* yeah, we do need ot thread init, even though camel isn't compiled with enable threads */ - g_thread_init (NULL); - - path = g_strdup_printf ("/tmp/camel-test"); - if (mkdir (path, 0700) == -1 && errno != EEXIST) - abort (); - - if (stat (path, &st) == -1) - abort (); - - if (!S_ISDIR (st.st_mode) || access (path, R_OK | W_OK | X_OK) == -1) - abort (); - - camel_init (path, FALSE); - g_free (path); - - camel_type_init (); - - info_table = g_hash_table_new(0, 0); - - signal(SIGSEGV, die); - signal(SIGABRT, die); - - /* default, just say what, how well we did, unless fail, then abort */ - camel_test_verbose = 1; - - for (i=0;i<argc;i++) { - if (argv[i][0] == '-') { - switch (argv[i][1]) { - case 'v': - camel_test_verbose = strlen(argv[i]); - break; - case 'q': - camel_test_verbose = 0; - break; - } - } - } -} - -void camel_test_start(const char *what) -{ - struct _state *s; - - CAMEL_TEST_LOCK; - - s = current_state(); - - if (!setup) - camel_test_init(0, 0); - - ok = 1; - - s->test = g_strdup(what); - - if (camel_test_verbose > 0) { - printf("Test: %s ... ", what); - fflush(stdout); - } - - CAMEL_TEST_UNLOCK; -} - -void camel_test_push(const char *what, ...) -{ - struct _stack *node; - va_list ap; - char *text; - struct _state *s; - - CAMEL_TEST_LOCK; - - s = current_state(); - - va_start(ap, what); - text = g_strdup_vprintf(what, ap); - va_end(ap); - - if (camel_test_verbose > 3) - printf("Start step: %s\n", text); - - node = g_malloc(sizeof(*node)); - node->what = text; - node->next = s->state; - node->fatal = 1; - s->state = node; - - CAMEL_TEST_UNLOCK; -} - -void camel_test_pull(void) -{ - struct _stack *node; - struct _state *s; - - CAMEL_TEST_LOCK; - - s = current_state(); - - g_assert(s->state); - - if (camel_test_verbose > 3) - printf("Finish step: %s\n", s->state->what); - - node = s->state; - s->state = node->next; - if (!node->fatal) - s->nonfatal--; - g_free(node->what); - g_free(node); - - CAMEL_TEST_UNLOCK; -} - -/* where to set breakpoints */ -void camel_test_break(void); - -void camel_test_break(void) -{ -} - -void camel_test_fail(const char *why, ...) -{ - va_list ap; - - va_start(ap, why); - camel_test_failv(why, ap); - va_end(ap); -} - - -void camel_test_failv(const char *why, va_list ap) -{ - char *text; - struct _state *s; - - CAMEL_TEST_LOCK; - - s = current_state(); - - text = g_strdup_vprintf(why, ap); - - if ((s->nonfatal == 0 && camel_test_verbose > 0) - || (s->nonfatal && camel_test_verbose > 1)) { - printf("Failed.\n%s\n", text); - camel_test_break(); - } - - g_free(text); - - if ((s->nonfatal == 0 && camel_test_verbose > 0) - || (s->nonfatal && camel_test_verbose > 2)) { - g_hash_table_foreach(info_table, (GHFunc)dump_action, 0); - } - - if (s->nonfatal == 0) { - exit(1); - } else { - ok=0; - if (camel_test_verbose > 1) { - printf("Known problem (ignored):\n"); - dump_action(CAMEL_TEST_ID, s, 0); - } - } - - CAMEL_TEST_UNLOCK; -} - -void camel_test_nonfatal(const char *what, ...) -{ - struct _stack *node; - va_list ap; - char *text; - struct _state *s; - - CAMEL_TEST_LOCK; - - s = current_state(); - - va_start(ap, what); - text = g_strdup_vprintf(what, ap); - va_end(ap); - - if (camel_test_verbose > 3) - printf("Start nonfatal: %s\n", text); - - node = g_malloc(sizeof(*node)); - node->what = text; - node->next = s->state; - node->fatal = 0; - s->nonfatal++; - s->state = node; - - CAMEL_TEST_UNLOCK; -} - -void camel_test_fatal(void) -{ - camel_test_pull(); -} - -void camel_test_end(void) -{ - if (camel_test_verbose > 0) { - if (ok) - printf("Ok\n"); - else - printf("Partial success\n"); - } - - fflush(stdout); -} - - - - -/* compare strings, ignore whitespace though */ -int string_equal(const char *a, const char *b) -{ - const char *ap, *bp; - - ap = a; - bp = b; - - while (*ap && *bp) { - while (*ap == ' ' || *ap == '\n' || *ap == '\t') - ap++; - while (*bp == ' ' || *bp == '\n' || *bp == '\t') - bp++; - - a = ap; - b = bp; - - while (*ap && *ap != ' ' && *ap != '\n' && *ap != '\t') - ap++; - while (*bp && *bp != ' ' && *bp != '\n' && *bp != '\t') - bp++; - - if (ap - a != bp - a - && ap - 1 > 0 - && memcmp(a, b, ap-a) != 0) { - return 0; - } - } - - return 1; -} - diff --git a/camel/tests/lib/camel-test.h b/camel/tests/lib/camel-test.h deleted file mode 100644 index 986a943fa3..0000000000 --- a/camel/tests/lib/camel-test.h +++ /dev/null @@ -1,68 +0,0 @@ - -/* some utilities for testing */ - -#include "config.h" - -#include <stdlib.h> -#include <glib.h> - -void camel_test_failv(const char *why, va_list ap); - -/* perform a check assertion */ -#define check(x) do {if (!(x)) { camel_test_fail("%s:%d: %s", __FILE__, __LINE__, #x); } } while (0) -/* check with message */ -#ifdef __GNUC__ -#define check_msg(x, y, z...) do {if (!(x)) { camel_test_fail("%s:%d: %s\n\t" #y, __FILE__, __LINE__, #x, ##z); } } while (0) -#else -static void check_msg(int truth, char *fmt, ...) -{ - /* no gcc, we lose the condition that failed, nm */ - if (!truth) { - va_list ap; - va_start(ap, fmt); - camel_test_failv(fmt, ap); - va_end(ap); - } -} -#endif - -#define check_count(object, expected) do { \ - if (CAMEL_OBJECT(object)->ref_count != expected) { \ - camel_test_fail("%s->ref_count != %s\n\tref_count = %d", #object, #expected, CAMEL_OBJECT(object)->ref_count); \ - } \ -} while (0) - -#define check_unref(object, expected) do { \ - check_count(object, expected); \ - camel_object_unref(CAMEL_OBJECT(object)); \ - if (expected == 1) { \ - object = NULL; \ - } \ -} while (0) - -#define test_free(mem) (g_free(mem), mem=NULL) - -#define push camel_test_push -#define pull camel_test_pull - -void camel_test_init(int argc, char **argv); - -/* start/finish a new test */ -void camel_test_start(const char *what); -void camel_test_end(void); - -/* start/finish a new test part */ -void camel_test_push(const char *what, ...); -void camel_test_pull(void); - -/* fail a test, with a reason why */ -void camel_test_fail(const char *why, ...); -void camel_test_failv(const char *why, va_list ap); - -/* Set whether a failed test quits. May be nested, but must be called in nonfatal/fatal pairs */ -void camel_test_nonfatal(const char *why, ...); -void camel_test_fatal(void); - -/* utility functions */ -/* compare strings, ignore whitespace though */ -int string_equal(const char *a, const char *b); diff --git a/camel/tests/lib/folders.c b/camel/tests/lib/folders.c deleted file mode 100644 index a670576564..0000000000 --- a/camel/tests/lib/folders.c +++ /dev/null @@ -1,568 +0,0 @@ -#include <string.h> - -#include "camel-test.h" -#include "folders.h" -#include "messages.h" - -#include "camel/camel-exception.h" - -/* check the total/unread is what we think it should be */ -void -test_folder_counts(CamelFolder *folder, int total, int unread) -{ - GPtrArray *s; - int i, myunread; - CamelMessageInfo *info; - - push("test folder counts %d total %d unread", total, unread); - - /* first, use the standard functions */ - check(camel_folder_get_message_count(folder) == total); - check(camel_folder_get_unread_message_count(folder) == total); - - /* next, use the summary */ - s = camel_folder_get_summary(folder); - check(s != NULL); - check(s->len == total); - myunread = s->len; - for (i=0;i<s->len;i++) { - info = s->pdata[i]; - if (info->flags & CAMEL_MESSAGE_SEEN) - myunread--; - } - check(unread == myunread); - camel_folder_free_summary(folder, s); - - /* last, use the uid list */ - s = camel_folder_get_uids(folder); - check(s != NULL); - check(s->len == total); - myunread = s->len; - for (i=0;i<s->len;i++) { - info = camel_folder_get_message_info(folder, s->pdata[i]); - if (info->flags & CAMEL_MESSAGE_SEEN) - myunread--; - camel_folder_free_message_info(folder, info); - } - check(unread == myunread); - camel_folder_free_uids(folder, s); - - pull(); -} - -static int -safe_strcmp(const char *a, const char *b) -{ - if (a == NULL && b == NULL) - return 0; - if (a == NULL) - return 1; - if (b == NULL) - return -1; - return strcmp(a, b); -} - -void -test_message_info(CamelMimeMessage *msg, const CamelMessageInfo *info) -{ - check_msg(safe_strcmp(camel_message_info_subject(info), camel_mime_message_get_subject(msg)) == 0, - "info->subject = '%s', get_subject() = '%s'", camel_message_info_subject(info), camel_mime_message_get_subject(msg)); - - /* FIXME: testing from/cc/to, etc is more tricky */ - - check(info->date_sent == camel_mime_message_get_date(msg, NULL)); - - /* date received isn't set for messages that haven't been sent anywhere ... */ - /*check(info->date_received == camel_mime_message_get_date_received(msg, NULL));*/ - - /* so is messageid/references, etc */ -} - -/* check a message is present */ -void -test_folder_message(CamelFolder *folder, const char *uid) -{ - CamelMimeMessage *msg; - CamelMessageInfo *info; - GPtrArray *s; - int i; - CamelException *ex = camel_exception_new(); - int found; - - push("uid %s is in folder", uid); - - /* first try getting info */ - info = camel_folder_get_message_info(folder, uid); - check(info != NULL); - check(strcmp(camel_message_info_uid(info), uid) == 0); - camel_folder_free_message_info(folder, info); - - /* then, getting message */ - msg = camel_folder_get_message(folder, uid, ex); - check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex)); - check(msg != NULL); - - /* cross check with info */ - test_message_info(msg, info); - - camel_object_unref((CamelObject *)msg); - - /* see if it is in the summary (only once) */ - s = camel_folder_get_summary(folder); - check(s != NULL); - found = 0; - for (i=0;i<s->len;i++) { - info = s->pdata[i]; - if (strcmp(camel_message_info_uid(info), uid) == 0) - found++; - } - check(found == 1); - camel_folder_free_summary(folder, s); - - /* check it is in the uid list */ - s = camel_folder_get_uids(folder); - check(s != NULL); - found = 0; - for (i=0;i<s->len;i++) { - if (strcmp(s->pdata[i], uid) == 0) - found++; - } - check(found == 1); - camel_folder_free_uids(folder, s); - - camel_exception_free(ex); - - pull(); -} - -/* check message not present */ -void -test_folder_not_message(CamelFolder *folder, const char *uid) -{ - CamelMimeMessage *msg; - CamelMessageInfo *info; - GPtrArray *s; - int i; - CamelException *ex = camel_exception_new(); - int found; - - push("uid '%s' is not in folder", uid); - - /* first try getting info */ - push("no message info"); - info = camel_folder_get_message_info(folder, uid); - check(info == NULL); - pull(); - - /* then, getting message */ - push("no message"); - msg = camel_folder_get_message(folder, uid, ex); - check(camel_exception_is_set(ex)); - check(msg == NULL); - camel_exception_clear(ex); - pull(); - - /* see if it is not in the summary (only once) */ - push("not in summary list"); - s = camel_folder_get_summary(folder); - check(s != NULL); - found = 0; - for (i=0;i<s->len;i++) { - info = s->pdata[i]; - if (strcmp(camel_message_info_uid(info), uid) == 0) - found++; - } - check(found == 0); - camel_folder_free_summary(folder, s); - pull(); - - /* check it is not in the uid list */ - push("not in uid list"); - s = camel_folder_get_uids(folder); - check(s != NULL); - found = 0; - for (i=0;i<s->len;i++) { - if (strcmp(s->pdata[i], uid) == 0) - found++; - } - check(found == 0); - camel_folder_free_uids(folder, s); - pull(); - - camel_exception_free(ex); - - pull(); -} - -/* test basic store operations on folders */ -/* TODO: Add subscription stuff */ -void -test_folder_basic(CamelSession *session, const char *storename, int local, int spool) -{ - CamelStore *store; - CamelException *ex = camel_exception_new(); - CamelFolder *folder; - char *what = g_strdup_printf("testing store: %s", storename); - - camel_test_start(what); - test_free(what); - - push("getting store"); - store = camel_session_get_store(session, storename, ex); - check_msg(!camel_exception_is_set(ex), "getting store: %s", camel_exception_get_description(ex)); - check(store != NULL); - pull(); - - /* local providers == no inbox */ - push("getting inbox folder"); - folder = camel_store_get_inbox(store, ex); - if (local) { - check(camel_exception_is_set(ex)); - check(folder == NULL); - camel_exception_clear(ex); - } else { - check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex)); - check(folder != NULL); - check_unref(folder, 2); - } - pull(); - - push("getting a non-existant folder, no create"); - folder = camel_store_get_folder(store, "unknown", 0, ex); - check(camel_exception_is_set(ex)); - check(folder == NULL); - camel_exception_clear(ex); - pull(); - - if (!spool) { - push("getting a non-existant folder, with create"); - folder = camel_store_get_folder(store, "testbox", CAMEL_STORE_FOLDER_CREATE, ex); - check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex)); - check(folder != NULL); - if (local) - check_unref(folder, 1); - else - check_unref(folder, 2); - pull(); - - push("getting an existing folder"); - folder = camel_store_get_folder(store, "testbox", 0, ex); - check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex)); - check(folder != NULL); - if (local) - check_unref(folder, 1); - else - check_unref(folder, 2); - pull(); - - push("renaming a non-existant folder"); - camel_store_rename_folder(store, "unknown1", "unknown2", ex); - check(camel_exception_is_set(ex)); - camel_exception_clear(ex); - pull(); - - push("renaming an existing folder"); - camel_store_rename_folder(store, "testbox", "testbox2", ex); - check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex)); - pull(); - - push("opening the old name of a renamed folder"); - folder = camel_store_get_folder(store, "testbox", 0, ex); - check(camel_exception_is_set(ex)); - check(folder == NULL); - camel_exception_clear(ex); - pull(); - - push("opening the new name of a renamed folder"); - folder = camel_store_get_folder(store, "testbox2", 0, ex); - check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex)); - check(folder != NULL); - if (local) - check_unref(folder, 1); - else - check_unref(folder, 2); - pull(); - } - - push("deleting a non-existant folder"); - camel_store_delete_folder(store, "unknown", ex); - check(camel_exception_is_set(ex)); - camel_exception_clear(ex); - pull(); - - if (!spool) { - push("deleting an existing folder"); - camel_store_delete_folder(store, "testbox2", ex); - check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex)); - pull(); - } - - push("opening a folder that has been deleted"); - folder = camel_store_get_folder(store, "testbox2", 0, ex); - check(camel_exception_is_set(ex)); - check(folder == NULL); - camel_exception_clear(ex); - pull(); - - check_unref(store, 1); - - camel_test_end(); - - camel_exception_free(ex); -} - - -/* todo: cross-check everything with folder_info checks as well */ -/* this should probably take a folder instead of a session ... */ -void -test_folder_message_ops(CamelSession *session, const char *name, int local, const char *mailbox) -{ - CamelStore *store; - CamelException *ex = camel_exception_new(); - CamelFolder *folder; - CamelMimeMessage *msg; - int j; - int indexed, max; - GPtrArray *uids; - CamelMessageInfo *info; - - max=local?2:1; - - for (indexed = 0;indexed<max;indexed++) { - char *what = g_strdup_printf("folder ops: %s %s", name, local?(indexed?"indexed":"non-indexed"):""); - int flags; - - camel_test_start(what); - test_free(what); - - push("getting store"); - store = camel_session_get_store(session, name, ex); - check_msg(!camel_exception_is_set(ex), "getting store: %s", camel_exception_get_description(ex)); - check(store != NULL); - pull(); - - push("creating %sindexed folder", indexed?"":"non-"); - if (indexed) - flags = CAMEL_STORE_FOLDER_CREATE|CAMEL_STORE_FOLDER_BODY_INDEX; - else - flags = CAMEL_STORE_FOLDER_CREATE; - folder = camel_store_get_folder(store, mailbox, flags, ex); - - /* we can't create mailbox outside of namespace, since we have no api for it, try - using inbox namespace, works for courier */ - if (folder == NULL) { - char *mbox = g_strdup_printf("INBOX/%s", mailbox); - mailbox = mbox; - camel_exception_clear(ex); - folder = camel_store_get_folder(store, mailbox, flags, ex); - } - - check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex)); - check(folder != NULL); - - /* verify empty/can't get nonexistant stuff */ - test_folder_counts(folder, 0, 0); - test_folder_not_message(folder, "0"); - test_folder_not_message(folder, ""); - - for (j=0;j<10;j++) { - char *content, *subject; - - push("creating test message"); - msg = test_message_create_simple(); - content = g_strdup_printf("Test message %d contents\n\n", j); - test_message_set_content_simple((CamelMimePart *)msg, 0, "text/plain", - content, strlen(content)); - test_free(content); - subject = g_strdup_printf("Test message %d", j); - camel_mime_message_set_subject(msg, subject); - pull(); - - push("appending simple message %d", j); - camel_folder_append_message(folder, msg, NULL, NULL, ex); - check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex)); - -#if 0 - /* sigh, this shouldn't be required, but the imap code is too dumb to do it itself */ - if (!local) { - push("forcing a refresh of folder updates"); - camel_folder_refresh_info(folder, ex); - check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex)); - pull(); - } -#endif - /*if (!local) - camel_test_nonfatal("unread counts dont seem right for imap");*/ - - test_folder_counts(folder, j+1, j+1); - - /*if (!local) - camel_test_fatal();*/ - - push("checking it is in the right uid slot & exists"); - uids = camel_folder_get_uids(folder); - check(uids != NULL); - check(uids->len == j+1); - if (uids->len > j) - test_folder_message(folder, uids->pdata[j]); - pull(); - - push("checking it is the right message (subject): %s", subject); - if (uids->len > j) { - info = camel_folder_get_message_info(folder, uids->pdata[j]); - check(info != NULL); - check_msg(strcmp(camel_message_info_subject(info), subject)==0, - "info->subject %s", camel_message_info_subject(info)); - camel_folder_free_message_info(folder, info); - } - camel_folder_free_uids(folder, uids); - pull(); - - test_free(subject); - - /*if (!local) - camel_test_fatal();*/ - - check_unref(msg, 1); - pull(); - } - - if (local) - check_unref(folder, 1); - else - check_unref(folder, 2); - pull(); - -#if 0 - push("deleting test folder, with messages in it"); - camel_store_delete_folder(store, mailbox, ex); - check(camel_exception_is_set(ex)); - camel_exception_clear(ex); - pull(); -#endif - - push("re-opening folder"); - folder = camel_store_get_folder(store, mailbox, flags, ex); - check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex)); - check(folder != NULL); - - /* verify counts */ - test_folder_counts(folder, 10, 10); - - /* re-check uid's, after a reload */ - uids = camel_folder_get_uids(folder); - check(uids != NULL); - check(uids->len == 10); - for (j=0;j<10;j++) { - char *subject = g_strdup_printf("Test message %d", j); - - push("verify reload of %s", subject); - test_folder_message(folder, uids->pdata[j]); - - info = camel_folder_get_message_info(folder, uids->pdata[j]); - check_msg(strcmp(camel_message_info_subject(info), subject)==0, - "info->subject %s", camel_message_info_subject(info)); - test_free(subject); - camel_folder_free_message_info(folder, info); - pull(); - } - - push("deleting first message & expunging"); - camel_folder_delete_message(folder, uids->pdata[0]); - test_folder_counts(folder, 10, 10); - camel_folder_expunge(folder, ex); - check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex)); - test_folder_not_message(folder, uids->pdata[0]); - test_folder_counts(folder, 9, 9); - - camel_folder_free_uids(folder, uids); - - uids = camel_folder_get_uids(folder); - check(uids != NULL); - check(uids->len == 9); - for (j=0;j<9;j++) { - char *subject = g_strdup_printf("Test message %d", j+1); - - push("verify after expunge of %s", subject); - test_folder_message(folder, uids->pdata[j]); - - info = camel_folder_get_message_info(folder, uids->pdata[j]); - check_msg(strcmp(camel_message_info_subject(info), subject)==0, - "info->subject %s", camel_message_info_subject(info)); - test_free(subject); - camel_folder_free_message_info(folder, info); - pull(); - } - pull(); - - push("deleting last message & expunging"); - camel_folder_delete_message(folder, uids->pdata[8]); - /* sync? */ - test_folder_counts(folder, 9, 9); - camel_folder_expunge(folder, ex); - check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex)); - test_folder_not_message(folder, uids->pdata[8]); - test_folder_counts(folder, 8, 8); - - camel_folder_free_uids(folder, uids); - - uids = camel_folder_get_uids(folder); - check(uids != NULL); - check(uids->len == 8); - for (j=0;j<8;j++) { - char *subject = g_strdup_printf("Test message %d", j+1); - - push("verify after expunge of %s", subject); - test_folder_message(folder, uids->pdata[j]); - - info = camel_folder_get_message_info(folder, uids->pdata[j]); - check_msg(strcmp(camel_message_info_subject(info), subject)==0, - "info->subject %s", camel_message_info_subject(info)); - test_free(subject); - camel_folder_free_message_info(folder, info); - pull(); - } - pull(); - - push("deleting all messages & expunging"); - for (j=0;j<8;j++) { - camel_folder_delete_message(folder, uids->pdata[j]); - } - /* sync? */ - test_folder_counts(folder, 8, 8); - camel_folder_expunge(folder, ex); - check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex)); - for (j=0;j<8;j++) { - test_folder_not_message(folder, uids->pdata[j]); - } - test_folder_counts(folder, 0, 0); - - camel_folder_free_uids(folder, uids); - pull(); - - if (local) - check_unref(folder, 1); - else - check_unref(folder, 2); - pull(); /* re-opening folder */ - - if (strcasecmp(mailbox, "INBOX") != 0) { - push("deleting test folder, with no messages in it"); - camel_store_delete_folder(store, mailbox, ex); - check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex)); - pull(); - } - - if (!local) { - push("disconneect service"); - camel_service_disconnect((CamelService *)store, TRUE, ex); - check_msg(!camel_exception_is_set(ex), "%s", camel_exception_get_description(ex)); - pull(); - } - - check_unref(store, 1); - camel_test_end(); - } - - camel_exception_free(ex); -} diff --git a/camel/tests/lib/folders.h b/camel/tests/lib/folders.h deleted file mode 100644 index ae981611d3..0000000000 --- a/camel/tests/lib/folders.h +++ /dev/null @@ -1,20 +0,0 @@ - -#include "camel/camel-session.h" -#include "camel/camel-store.h" - -#include <camel/camel-folder.h> -#include <camel/camel-folder-summary.h> -#include <camel/camel-mime-message.h> - -/* check the total/unread is what we think it should be, everywhere it can be determined */ -void test_folder_counts(CamelFolder *folder, int total, int unread); -/* cross-check info/msg */ -void test_message_info(CamelMimeMessage *msg, const CamelMessageInfo *info); -/* check a message is present everywhere it should be */ -void test_folder_message(CamelFolder *folder, const char *uid); -/* check message not present everywhere it shouldn't be */ -void test_folder_not_message(CamelFolder *folder, const char *uid); -/* test basic folder ops on a store */ -void test_folder_basic(CamelSession *session, const char *storename, int local, int spool); -/* test basic message operations on a folder */ -void test_folder_message_ops(CamelSession *session, const char *storename, int local, const char *foldername); diff --git a/camel/tests/lib/messages.c b/camel/tests/lib/messages.c deleted file mode 100644 index 21d77582ad..0000000000 --- a/camel/tests/lib/messages.c +++ /dev/null @@ -1,154 +0,0 @@ -#include <string.h> - -#include "messages.h" -#include "camel-test.h" - -#include <camel/camel-mime-message.h> -#include <camel/camel-stream-fs.h> -#include <camel/camel-stream-mem.h> - -CamelMimeMessage * -test_message_create_simple(void) -{ - CamelMimeMessage *msg; - CamelInternetAddress *addr; - - msg = camel_mime_message_new(); - - addr = camel_internet_address_new(); - camel_internet_address_add(addr, "Michael Zucchi", "zed@nowhere.com"); - camel_mime_message_set_from(msg, addr); - camel_address_remove((CamelAddress *)addr, -1); - camel_internet_address_add(addr, "POSTMASTER", "POSTMASTER@somewhere.net"); - camel_mime_message_set_recipients(msg, CAMEL_RECIPIENT_TYPE_TO, addr); - camel_address_remove((CamelAddress *)addr, -1); - camel_internet_address_add(addr, "Michael Zucchi", "zed@nowhere.com"); - camel_mime_message_set_recipients(msg, CAMEL_RECIPIENT_TYPE_CC, addr); - - check_unref(addr, 1); - - camel_mime_message_set_subject(msg, "Simple message subject"); - camel_mime_message_set_date(msg, time(0), 930); - - return msg; -} - -static void -content_finalise(CamelObject *folder, void *crap, void *ba) -{ - g_byte_array_free(ba, TRUE); -} - -void -test_message_set_content_simple(CamelMimePart *part, int how, const char *type, const char *text, int len) -{ - CamelStreamMem *content = NULL; - CamelDataWrapper *dw; - static GByteArray *ba; - - switch (how) { - case 0: - camel_mime_part_set_content(part, text, len, type); - break; - case 1: - content = (CamelStreamMem *)camel_stream_mem_new_with_buffer(text, len); - break; - case 2: - content = (CamelStreamMem *)camel_stream_mem_new(); - camel_stream_mem_set_buffer(content, text, len); - break; - case 3: - ba = g_byte_array_new(); - g_byte_array_append(ba, text, len); - - content = (CamelStreamMem *)camel_stream_mem_new_with_byte_array(ba); - ba = NULL; - break; - case 4: - ba = g_byte_array_new(); - g_byte_array_append(ba, text, len); - - content = (CamelStreamMem *)camel_stream_mem_new(); - camel_stream_mem_set_byte_array(content, ba); - - camel_object_hook_event((CamelObject *)content, "finalize", content_finalise, ba); - break; - } - - if (content != 0) { - dw = camel_data_wrapper_new(); - camel_data_wrapper_set_mime_type (dw, type); - - camel_data_wrapper_construct_from_stream(dw, (CamelStream *)content); - camel_medium_set_content_object((CamelMedium *)part, dw); - - check_unref(content, 2); - check_unref(dw, 2); - } -} - -int -test_message_write_file(CamelMimeMessage *msg, const char *name) -{ - CamelStreamFs *file; - int ret; - - file = (CamelStreamFs *)camel_stream_fs_new_with_name(name, O_CREAT|O_WRONLY, 0600); - camel_data_wrapper_write_to_stream((CamelDataWrapper *)msg, (CamelStream *)file); - ret = camel_stream_close((CamelStream *)file); - - check(((CamelObject *)file)->ref_count == 1); - camel_object_unref((CamelObject *)file); - - return ret; -} - -CamelMimeMessage * -test_message_read_file(const char *name) -{ - CamelStreamFs *file; - CamelMimeMessage *msg2; - - file = (CamelStreamFs *)camel_stream_fs_new_with_name(name, O_RDONLY, 0); - msg2 = camel_mime_message_new(); - - camel_data_wrapper_construct_from_stream((CamelDataWrapper *)msg2, (CamelStream *)file); - /* file's refcount may be > 1 if the message is real big */ - check(CAMEL_OBJECT(file)->ref_count >=1); - camel_object_unref((CamelObject *)file); - - return msg2; -} - -int -test_message_compare_content(CamelDataWrapper *dw, const char *text, int len) -{ - CamelStreamMem *content; - - /* sigh, ok, so i len == 0, dw will probably be 0 too - camel_mime_part_set_content is weird like that */ - if (dw == 0 && len == 0) - return 0; - - content = (CamelStreamMem *)camel_stream_mem_new(); - camel_data_wrapper_write_to_stream(dw, (CamelStream *)content); - - check_msg(content->buffer->len == len, "buffer->len = %d, len = %d", content->buffer->len, len); - check_msg(memcmp(content->buffer->data, text, content->buffer->len) == 0, "len = %d", len); - - check_unref(content, 1); - - return 0; -} - -int -test_message_compare_header(CamelMimeMessage *m1, CamelMimeMessage *m2) -{ - return 0; -} - -int -test_message_compare_messages(CamelMimeMessage *m1, CamelMimeMessage *m2) -{ - return 0; -} diff --git a/camel/tests/lib/messages.h b/camel/tests/lib/messages.h deleted file mode 100644 index 9cb5758826..0000000000 --- a/camel/tests/lib/messages.h +++ /dev/null @@ -1,12 +0,0 @@ - -#include <camel/camel-mime-message.h> - -/* how many ways to set the content contents */ -#define SET_CONTENT_WAYS (5) - -/* messages.c */ -CamelMimeMessage *test_message_create_simple(void); -void test_message_set_content_simple(CamelMimePart *part, int how, const char *type, const char *text, int len); -int test_message_write_file(CamelMimeMessage *msg, const char *name); -CamelMimeMessage *test_message_read_file(const char *name); -int test_message_compare_content(CamelDataWrapper *dw, const char *text, int len); diff --git a/camel/tests/lib/session.c b/camel/tests/lib/session.c deleted file mode 100644 index bf23fbe377..0000000000 --- a/camel/tests/lib/session.c +++ /dev/null @@ -1,44 +0,0 @@ -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include "session.h" - -static void -class_init (CamelTestSessionClass *camel_test_session_class) -{ - CamelSessionClass *camel_session_class = - CAMEL_SESSION_CLASS (camel_test_session_class); -} - -CamelType -camel_test_session_get_type (void) -{ - static CamelType type = CAMEL_INVALID_TYPE; - - if (type == CAMEL_INVALID_TYPE) { - type = camel_type_register ( - camel_session_get_type (), - "CamelTestSession", - sizeof (CamelTestSession), - sizeof (CamelTestSessionClass), - (CamelObjectClassInitFunc) class_init, - NULL, - NULL, - NULL); - } - - return type; -} - -CamelSession * -camel_test_session_new (const char *path) -{ - CamelSession *session; - - session = CAMEL_SESSION (camel_object_new (CAMEL_TEST_SESSION_TYPE)); - - camel_session_construct (session, path); - - return session; -} diff --git a/camel/tests/lib/session.h b/camel/tests/lib/session.h deleted file mode 100644 index e69ef65e2e..0000000000 --- a/camel/tests/lib/session.h +++ /dev/null @@ -1,19 +0,0 @@ -#include <camel/camel-session.h> - -#define CAMEL_TEST_SESSION_TYPE (camel_test_session_get_type ()) -#define CAMEL_TEST_SESSION(obj) (CAMEL_CHECK_CAST((obj), CAMEL_TEST_SESSION_TYPE, CamelTestSession)) -#define CAMEL_TEST_SESSION_CLASS(k) (CAMEL_CHECK_CLASS_CAST ((k), CAMEL_TEST_SESSION_TYPE, CamelTestSessionClass)) -#define CAMEL_TEST_IS_SESSION(o) (CAMEL_CHECK_TYPE((o), CAMEL_TEST_SESSION_TYPE)) - -typedef struct _CamelTestSession { - CamelSession parent_object; - -} CamelTestSession; - -typedef struct _CamelTestSessionClass { - CamelSessionClass parent_class; - -} CamelTestSessionClass; - -CamelType camel_test_session_get_type (void); -CamelSession *camel_test_session_new (const char *path); diff --git a/camel/tests/lib/streams.c b/camel/tests/lib/streams.c deleted file mode 100644 index e4dc006363..0000000000 --- a/camel/tests/lib/streams.c +++ /dev/null @@ -1,244 +0,0 @@ -/* - stream tests - - todo: do we need a seek test that seeks beyond the eos, writes, - then reads and checks for 0's in the space? -*/ - -#include <string.h> - -#include "camel/camel-stream.h" -#include "camel/camel-seekable-stream.h" -#include "camel/camel-seekable-substream.h" - -#include "streams.h" - -#include "camel-test.h" - -static char teststring[] = "\xaa\x55\xc0\x0c\xff\x00"; -static char testbuf[10240]; - -/* pass in an empty read/write stream */ -void -test_stream_seekable_writepart(CamelSeekableStream *s) -{ - off_t end; - int i; - - push("seekable stream test, writing "); - - check(camel_seekable_stream_tell(s) == 0); - check(camel_seekable_stream_seek(s, 0, CAMEL_STREAM_SET) == 0); - check(camel_seekable_stream_tell(s) == 0); - - check(camel_stream_write(CAMEL_STREAM(s), "", 0) == 0); - check(camel_seekable_stream_tell(s) == 0); - check(camel_stream_write(CAMEL_STREAM(s), "\n", 1) == 1); - check(camel_seekable_stream_tell(s) == 1); - - for (i=0;i<10240;i++) { - check(camel_stream_write(CAMEL_STREAM(s), teststring, sizeof(teststring)) == sizeof(teststring)); - check(camel_seekable_stream_tell(s) == 1 + (i+1)*sizeof(teststring)); - } - end = 10240*sizeof(teststring)+1; - - check_msg(camel_seekable_stream_seek(s, 0, CAMEL_STREAM_END) == end, "seek =%d end = %d", - camel_seekable_stream_seek(s, 0, CAMEL_STREAM_END), end); - - check(camel_seekable_stream_seek(s, 0, CAMEL_STREAM_END) == end); - check(camel_seekable_stream_tell(s) == end); - /* need to read 0 first to set eos */ - check(camel_stream_read(CAMEL_STREAM(s), testbuf, 10240) == 0); - check(camel_stream_eos(CAMEL_STREAM(s))); - - pull(); -} - -void -test_stream_seekable_readpart(CamelSeekableStream *s) -{ - off_t off, new, end; - int i, j; - - push("seekable stream test, re-reading"); - - end = 10240*sizeof(teststring)+1; - - check(camel_seekable_stream_seek(s, 0, CAMEL_STREAM_SET) == 0); - check(camel_seekable_stream_tell(s) == 0); - check(!camel_stream_eos(CAMEL_STREAM(s))); - - off = 0; - for (i=0;i<1024;i++) { - - new = i*3; - - /* exercise all seek methods */ - switch(i % 3) { - case 0: - check(camel_seekable_stream_seek(s, new, CAMEL_STREAM_SET) == new); - break; - case 1: - check(camel_seekable_stream_seek(s, new-off, CAMEL_STREAM_CUR) == new); - break; - case 2: - check(camel_seekable_stream_seek(s, new-end, CAMEL_STREAM_END) == new); - break; - } - check(camel_seekable_stream_tell(s) == new); - - check(camel_stream_read(CAMEL_STREAM(s), testbuf, i*3) == i*3); - for (j=0;j<i*3;j++) { - int k = new + j; - - if (k==0) { - check(testbuf[j] == '\n'); - } else { - check(testbuf[j] == teststring[(k-1) % sizeof(teststring)]); - } - } - off = new+i*3; - } - - /* verify end-of-file behaviour */ - check(camel_seekable_stream_seek(s, -1, CAMEL_STREAM_END) == end-1); - check(camel_seekable_stream_tell(s) == end-1); - - check(camel_stream_read(CAMEL_STREAM(s), testbuf, 10240) == 1); - check(testbuf[0] == teststring[sizeof(teststring)-1]); - - check(camel_stream_read(CAMEL_STREAM(s), testbuf, 10240) == 0); - check(camel_seekable_stream_seek(s, 0, CAMEL_STREAM_CUR) == end); - check(camel_seekable_stream_tell(s) == end); - check(camel_stream_eos(CAMEL_STREAM(s))); - - pull(); -} - -/* - 0 = write to the substream - 1 = write to the parent stream at the right spot -*/ -void -test_seekable_substream_writepart(CamelStream *s, int type) -{ - CamelSeekableStream *ss = (CamelSeekableStream *)s; - CamelSeekableSubstream *sus = (CamelSeekableSubstream *)s; - CamelSeekableStream *sp = sus->parent_stream; - int i, len; - off_t end; - - push("writing substream, type %d", type); - - if (type == 1) { - check(camel_seekable_stream_seek(sp, ss->bound_start, CAMEL_STREAM_SET) == ss->bound_start); - s = (CamelStream *)sp; - } else { - check(camel_seekable_stream_tell(ss) == ss->bound_start); - check(camel_seekable_stream_seek(ss, 0, CAMEL_STREAM_SET) == ss->bound_start); - } - - check(camel_seekable_stream_tell(CAMEL_SEEKABLE_STREAM(s)) == ss->bound_start); - - check(camel_stream_write(s, "", 0) == 0); - check(camel_seekable_stream_tell(CAMEL_SEEKABLE_STREAM(s)) == ss->bound_start); - - /* fill up the bounds with writes */ - if (ss->bound_end != CAMEL_STREAM_UNBOUND) { - for (i=0;i<(ss->bound_end-ss->bound_start)/sizeof(teststring);i++) { - check(camel_stream_write(s, teststring, sizeof(teststring)) == sizeof(teststring)); - check(camel_seekable_stream_tell(CAMEL_SEEKABLE_STREAM(s)) == ss->bound_start + (i+1)*sizeof(teststring)); - } - len = (ss->bound_end-ss->bound_start) % sizeof(teststring); - check(camel_stream_write(s, teststring, len) == len); - check(camel_seekable_stream_tell(CAMEL_SEEKABLE_STREAM(s)) == ss->bound_end); - if (type == 0) { - check(camel_stream_write(s, teststring, sizeof(teststring)) == 0); - check(camel_stream_eos(s)); - check(camel_seekable_stream_tell(CAMEL_SEEKABLE_STREAM(s)) == ss->bound_end); - } - } else { - /* just 10K */ - for (i=0;i<10240;i++) { - check(camel_stream_write(CAMEL_STREAM(s), teststring, sizeof(teststring)) == sizeof(teststring)); - check(camel_seekable_stream_tell(CAMEL_SEEKABLE_STREAM(s)) == ss->bound_start + (i+1)*sizeof(teststring)); - } - - /* we can't really verify any end length here */ - } - - pull(); -} - -void -test_seekable_substream_readpart(CamelStream *s) -{ - CamelSeekableStream *ss = (CamelSeekableStream *)s; - CamelSeekableSubstream *sus = (CamelSeekableSubstream *)s; - CamelSeekableStream *sp = sus->parent_stream; - int i, len; - off_t end; - - push("reading substream"); - - check(camel_seekable_stream_seek(ss, 0, CAMEL_STREAM_SET) == ss->bound_start); - check(camel_seekable_stream_tell(ss) == ss->bound_start); - - check(camel_seekable_stream_seek(sp, ss->bound_start, CAMEL_STREAM_SET) == ss->bound_start); - check(camel_seekable_stream_tell(sp) == ss->bound_start); - - /* check writes, cross check with parent stream */ - if (ss->bound_end != CAMEL_STREAM_UNBOUND) { - for (i=0;i<(ss->bound_end-ss->bound_start)/sizeof(teststring);i++) { - check(camel_stream_read(s, testbuf, sizeof(teststring)) == sizeof(teststring)); - check(memcmp(testbuf, teststring, sizeof(teststring)) == 0); - check(camel_seekable_stream_tell(ss) == ss->bound_start + (i+1)*sizeof(teststring)); - - /* yeah great, the substreams affect the seek ... */ - check(camel_seekable_stream_seek(sp, ss->bound_start + (i)*sizeof(teststring), CAMEL_STREAM_SET) == ss->bound_start + i*sizeof(teststring)); - check(camel_stream_read(CAMEL_STREAM(sp), testbuf, sizeof(teststring)) == sizeof(teststring)); - check(memcmp(testbuf, teststring, sizeof(teststring)) == 0); - check(camel_seekable_stream_tell(sp) == ss->bound_start + (i+1)*sizeof(teststring)); - } - len = (ss->bound_end-ss->bound_start) % sizeof(teststring); - check(camel_stream_read(s, testbuf, len) == len); - check(memcmp(testbuf, teststring, len) == 0); - - check(camel_seekable_stream_seek(sp, ss->bound_end - len, CAMEL_STREAM_SET) == ss->bound_end - len); - check(camel_stream_read(CAMEL_STREAM(sp), testbuf, len) == len); - check(memcmp(testbuf, teststring, len) == 0); - - check(camel_stream_eos(s)); - check(camel_seekable_stream_tell(ss) == ss->bound_end); - check(camel_seekable_stream_tell(sp) == ss->bound_end); - check(camel_stream_read(s, testbuf, 1024) == 0); - check(camel_seekable_stream_tell(ss) == ss->bound_end); - check(camel_seekable_stream_tell(sp) == ss->bound_end); - check(camel_stream_eos(s)); - } else { - /* just 10K */ - for (i=0;i<10240;i++) { - check(camel_stream_read(s, testbuf, sizeof(teststring)) == sizeof(teststring)); - check(memcmp(testbuf, teststring, sizeof(teststring)) == 0); - check(camel_seekable_stream_tell(ss) == ss->bound_start + (i+1)*sizeof(teststring)); - - check(camel_seekable_stream_seek(sp, ss->bound_start + (i)*sizeof(teststring), CAMEL_STREAM_SET) == ss->bound_start + i*sizeof(teststring)); - check(camel_stream_read(CAMEL_STREAM(sp), testbuf, sizeof(teststring)) == sizeof(teststring)); - check(memcmp(testbuf, teststring, sizeof(teststring)) == 0); - check(camel_seekable_stream_tell(sp) == ss->bound_start + (i+1)*sizeof(teststring)); - } - - /* unbound - we dont know the real length */ -#if 0 - end = 10240*sizeof(teststring)+ss->bound_start; - - check(camel_seekable_stream_seek(ss, 0, CAMEL_STREAM_END) == end); - check(camel_seekable_stream_tell(ss) == end); - /* need to read 0 first to set eos */ - check(camel_stream_read(s, testbuf, 10240) == 0); - check(camel_stream_eos(s)); -#endif - } - - pull(); -} diff --git a/camel/tests/lib/streams.h b/camel/tests/lib/streams.h deleted file mode 100644 index df52e283d0..0000000000 --- a/camel/tests/lib/streams.h +++ /dev/null @@ -1,12 +0,0 @@ - -#include "camel/camel-seekable-stream.h" - -/* call one, then the other on the same stream content */ -void test_stream_seekable_writepart(CamelSeekableStream *s); -void test_stream_seekable_readpart(CamelSeekableStream *s); - -/* same, for substreams, multiple ways of writing */ -#define SEEKABLE_SUBSTREAM_WAYS (2) - -void test_seekable_substream_writepart(CamelStream *s, int type); -void test_seekable_substream_readpart(CamelStream *s); diff --git a/camel/tests/message/.cvsignore b/camel/tests/message/.cvsignore deleted file mode 100644 index 4f58c83bd0..0000000000 --- a/camel/tests/message/.cvsignore +++ /dev/null @@ -1,15 +0,0 @@ -.deps -Makefile -Makefile.in -.libs -.deps -*.lo -*.la -test1 -test2 -test3 -*.msg -*.bb -*.bbg -*.da -*.gcov diff --git a/camel/tests/message/Makefile.am b/camel/tests/message/Makefile.am deleted file mode 100644 index 47f0024901..0000000000 --- a/camel/tests/message/Makefile.am +++ /dev/null @@ -1,24 +0,0 @@ - -INCLUDES = \ - -I$(includedir) \ - -I$(top_srcdir) \ - -I$(top_srcdir)/intl \ - -I$(top_srcdir)/e-util \ - -I$(top_srcdir)/camel \ - -I$(top_srcdir)/camel/tests/lib \ - -DG_LOG_DOMAIN=\"evolution-tests\" \ - $(CAMEL_CFLAGS) - -LDADD = \ - $(top_builddir)/camel/libcamel.la \ - $(top_builddir)/e-util/libeutil.la \ - $(top_builddir)/camel/tests/lib/libcameltest.a \ - $(INTLLIBS) \ - $(EVOLUTION_MAIL_LIBS) - -check_PROGRAMS = \ - test1 \ - test2 \ - test3 - -TESTS = test1 test2 test3 diff --git a/camel/tests/message/README b/camel/tests/message/README deleted file mode 100644 index 280344ce9b..0000000000 --- a/camel/tests/message/README +++ /dev/null @@ -1,5 +0,0 @@ - -test1 creating, saving, loading simple messages -test2 camelinternetaddress tests, internationalised addresses, etc. -test3 multipart messages - diff --git a/camel/tests/message/test1.c b/camel/tests/message/test1.c deleted file mode 100644 index 6eadfcacc2..0000000000 --- a/camel/tests/message/test1.c +++ /dev/null @@ -1,201 +0,0 @@ -/* - test1.c - - Create a message, save it. - - Retrieve message, compare content. - - - Operations: - writing/loading from different types of streams - reading/writing different content - reading/writing different encodings - reading/writing different charsets - - Just testing streams: - different stream types - different file ops - seek, eof, etc. -*/ - -#include "camel-test.h" -#include "messages.h" - -/* for stat */ -#include <sys/stat.h> -#include <unistd.h> -#include <string.h> - -#include <camel/camel-mime-message.h> -#include <camel/camel-stream-fs.h> -#include <camel/camel-stream-mem.h> - -struct _text { - char *text; - int len; -}; - -#define MAX_TEXTS (14) -struct _text texts[MAX_TEXTS]; - -static void -setup(void) -{ - int i, j; - char *p; - - /* setup various edge and other general cases */ - texts[0].text = ""; - texts[0].len = 0; - texts[1].text = ""; - texts[1].len = 1; - texts[2].text = "\n"; - texts[2].len = 1; - texts[3].text = "A"; - texts[3].len = 1; - texts[4].text = "This is a test.\n."; - texts[4].len = strlen(texts[4].text); - texts[5].text = "This is a test.\n\n.\n"; - texts[5].len = strlen(texts[5].text); - texts[6].text = g_malloc0(1024); - texts[6].len = 1024; - texts[7].text = g_malloc0(102400); - texts[7].len = 102400; - texts[8].text = g_malloc(1024); - memset(texts[8].text, '\n', 1024); - texts[8].len = 1024; - texts[9].text = g_malloc(102400); - memset(texts[9].text, '\n', 102400); - texts[9].len = 102400; - texts[10].text = g_malloc(1024); - memset(texts[10].text, ' ', 1024); - texts[10].len = 1024; - texts[11].text = g_malloc(102400); - memset(texts[11].text, ' ', 102400); - texts[11].len = 102400; - - srand(42); - p = texts[12].text = g_malloc(1024); - for (i=0;i<1024;i++) { - j = rand(); - if (j<RAND_MAX/120) - *p++ = '\n'; - else - *p++ = (j % 95) + 32; - } - texts[12].len = 1024; - p = texts[13].text = g_malloc(102400); - for (i=0;i<102400;i++) { - j = rand(); - if (j<RAND_MAX/120) - *p++ = '\n'; - else - *p++ = (j % 95) + 32; - } - texts[13].len = 102400; -} - -static void cleanup(void) -{ - int i; - - for (i=6;i<14;i++) { - g_free(texts[i].text); - } -} - -int main(int argc, char **argv) -{ - CamelMimeMessage *msg, *msg2; - int i, j; - char *text; - int len; - - camel_test_init(argc, argv); - - setup(); - - camel_test_start("Simple memory-based content creation"); - - /* test all ways of setting simple content for a message (i.e. memory based) */ - for (j=0;j<MAX_TEXTS;j++) { - push("testing text number %d", j); - text = texts[j].text; - len = texts[j].len; - for (i=0;i<SET_CONTENT_WAYS;i++) { - push("create simple message %d", i); - msg = test_message_create_simple(); - - push("set simple content"); - test_message_set_content_simple((CamelMimePart *)msg, i, "text/plain", text, len); - pull(); - - push("compare original content"); - test_message_compare_content(camel_medium_get_content_object((CamelMedium *)msg), text, len); - pull(); - - push("save message to test1.msg"); - unlink("test1.msg"); - test_message_write_file(msg, "test1.msg"); - check_unref(msg, 1); - pull(); - - push("read from test1.msg"); - msg2 = test_message_read_file("test1.msg"); - pull(); - - push("compare read with original content"); - test_message_compare_content(camel_medium_get_content_object((CamelMedium *)msg2), text, len); - check_unref(msg2, 1); - pull(); - - unlink("test1.msg"); - pull(); - } - pull(); - } - - camel_test_end(); - - camel_test_start("Different encodings"); - for (j=0;j<MAX_TEXTS;j++) { - push("testing text number %d", j); - text = texts[j].text; - len = texts[j].len; - for (i=0;i<CAMEL_MIME_PART_NUM_ENCODINGS;i++) { - - push("test simple message, encoding %s", camel_mime_part_encoding_to_string(i)); - msg = test_message_create_simple(); - - push("set simple content"); - test_message_set_content_simple((CamelMimePart *)msg, 0, "text/plain", text, len); - pull(); - - camel_mime_part_set_encoding((CamelMimePart *)msg, i); - - push("save message to test1.msg"); - unlink("test1.msg"); - test_message_write_file(msg, "test1.msg"); - check_unref(msg, 1); - pull(); - - push("read from test1.msg"); - msg2 = test_message_read_file("test1.msg"); - pull(); - - push("compare read with original content"); - test_message_compare_content(camel_medium_get_content_object((CamelMedium *)msg2), text, len); - check_unref(msg2, 1); - pull(); - - unlink("test1.msg"); - pull(); - } - pull(); - } - camel_test_end(); - - cleanup(); - - return 0; -} diff --git a/camel/tests/message/test2.c b/camel/tests/message/test2.c deleted file mode 100644 index 95b0e324aa..0000000000 --- a/camel/tests/message/test2.c +++ /dev/null @@ -1,326 +0,0 @@ -#include "camel-test.h" -#include "messages.h" -#include "addresses.h" - -/* for stat */ -#include <sys/stat.h> -#include <unistd.h> -#include <string.h> -#include <stdio.h> -#include <iconv.h> - -#include <camel/camel-internet-address.h> -#include <camel/camel-address.h> - -#include "address-data.h" - -static char *convert(const char *in, const char *from, const char *to) -{ - iconv_t ic = iconv_open(to, from); - char *out, *outp; - const char *inp; - int inlen, outlen; - - if (ic == (iconv_t)-1) - return g_strdup(in); - - inlen = strlen(in); - outlen = inlen*5 + 16; - - outp = out = g_malloc(outlen); - inp = in; - - if (iconv(ic, &inp, &inlen, &outp, &outlen) == -1) { - test_free(out); - iconv_close(ic); - return g_strdup(in); - } - - if (iconv(ic, NULL, 0, &outp, &outlen) == -1) { - test_free(out); - iconv_close(ic); - return g_strdup(in); - } - - iconv_close(ic); - - *outp = 0; - -#if 0 - /* lets see if we can convert back again? */ - { - char *nout, *noutp; - iconv_t ic = iconv_open(from, to); - - inp = out; - inlen = strlen(out); - outlen = inlen*5 + 16; - noutp = nout = g_malloc(outlen); - if (iconv(ic, &inp, &inlen, &noutp, &outlen) == -1 - || iconv(ic, NULL, 0, &noutp, &outlen) == -1) { - g_warning("Cannot convert '%s' \n from %s to %s: %s\n", in, to, from, strerror(errno)); - } - iconv_close(ic); - } - - /* and lets see what camel thinks out optimal charset is */ - { - printf("Camel thinks the best encoding of '%s' is %s, although we converted from %s\n", - in, camel_charset_best(out, strlen(out)), from); - } -#endif - - return out; -} - -#define to_utf8(in, type) convert(in, type, "utf-8") -#define from_utf8(in, type) convert(in, "utf-8", type) - -#define ARRAY_LEN(x) (sizeof(x)/sizeof(x[0])) - -int main(int argc, char **argv) -{ - int i; - CamelInternetAddress *addr, *addr2; - char *name; - char *charset; - const char *real, *where; - char *enc, *enc2, *format, *format2; - - camel_test_init(argc, argv); - - camel_test_start("CamelInternetAddress, basics"); - - addr = camel_internet_address_new(); - - push("Test blank address"); - check(camel_address_length(CAMEL_ADDRESS(addr)) == 0); - check(camel_internet_address_get(addr, 0, &real, &where) == FALSE); - pull(); - - push("Test blank clone"); - addr2 = CAMEL_INTERNET_ADDRESS(camel_address_new_clone(CAMEL_ADDRESS(addr))); - test_address_compare(addr, addr2); - check_unref(addr2, 1); - pull(); - - push("Test add 1"); - camel_internet_address_add(addr, "Zed", "nowhere@here.com.au"); - check(camel_address_length(CAMEL_ADDRESS(addr)) == 1); - check(camel_internet_address_get(addr, 0, &real, &where) == TRUE); - check_msg(string_equal("Zed", real), "real = '%s'", real); - check(strcmp(where, "nowhere@here.com.au") == 0); - pull(); - - push("Test clone 1"); - addr2 = CAMEL_INTERNET_ADDRESS(camel_address_new_clone(CAMEL_ADDRESS(addr))); - test_address_compare(addr, addr2); - check_unref(addr2, 1); - pull(); - - push("Test add many"); - for (i=1;i<10;i++) { - char name[16], a[32]; - sprintf(name, "Zed %d", i); - sprintf(a, "nowhere@here-%d.com.au", i); - camel_internet_address_add(addr, name, a); - check(camel_address_length(CAMEL_ADDRESS(addr)) == i+1); - check(camel_internet_address_get(addr, i, &real, &where) == TRUE); - check_msg(string_equal(name, real), "name = '%s' real = '%s'", name, real); - check(strcmp(where, a) == 0); - } - pull(); - - /* put a few of these in to make it look like its doing something impressive ... :) */ - camel_test_end(); - camel_test_start("CamelInternetAddress, search"); - - push("Test search"); - camel_test_nonfatal("Address comparisons should ignore whitespace??"); - check(camel_internet_address_find_name(addr, "Zed 1", &where) == 1); - check(camel_internet_address_find_name(addr, "Zed 9", &where) == 9); - check(camel_internet_address_find_name(addr, "Zed", &where) == 0); - check(camel_internet_address_find_name(addr, " Zed", &where) == 0); - check(camel_internet_address_find_name(addr, "Zed ", &where) == 0); - check(camel_internet_address_find_name(addr, " Zed ", &where) == 0); - check(camel_internet_address_find_name(addr, "Zed 20", &where) == -1); - check(camel_internet_address_find_name(addr, "", &where) == -1); - /* interface dont handle nulls :) */ - /*check(camel_internet_address_find_name(addr, NULL, &where) == -1);*/ - - check(camel_internet_address_find_address(addr, "nowhere@here-1.com.au", &where) == 1); - check(camel_internet_address_find_address(addr, "nowhere@here-1 . com.au", &where) == 1); - check(camel_internet_address_find_address(addr, "nowhere@here-2 .com.au ", &where) == 2); - check(camel_internet_address_find_address(addr, " nowhere @here-3.com.au", &where) == 3); - check(camel_internet_address_find_address(addr, "nowhere@here-20.com.au ", &where) == -1); - check(camel_internet_address_find_address(addr, "", &where) == -1); - /*check(camel_internet_address_find_address(addr, NULL, &where) == -1);*/ - camel_test_fatal(); - pull(); - - camel_test_end(); - camel_test_start("CamelInternetAddress, copy/cat/clone"); - - push("Test clone many"); - addr2 = CAMEL_INTERNET_ADDRESS(camel_address_new_clone(CAMEL_ADDRESS(addr))); - test_address_compare(addr, addr2); - pull(); - - push("Test remove items"); - camel_address_remove(CAMEL_ADDRESS(addr2), 0); - check(camel_address_length(CAMEL_ADDRESS(addr2)) == 9); - camel_address_remove(CAMEL_ADDRESS(addr2), 0); - check(camel_address_length(CAMEL_ADDRESS(addr2)) == 8); - camel_address_remove(CAMEL_ADDRESS(addr2), 5); - check(camel_address_length(CAMEL_ADDRESS(addr2)) == 7); - camel_address_remove(CAMEL_ADDRESS(addr2), 10); - check(camel_address_length(CAMEL_ADDRESS(addr2)) == 7); - camel_address_remove(CAMEL_ADDRESS(addr2), -1); - check(camel_address_length(CAMEL_ADDRESS(addr2)) == 0); - check_unref(addr2, 1); - pull(); - - push("Testing copy/cat"); - push("clone + cat"); - addr2 = CAMEL_INTERNET_ADDRESS(camel_address_new_clone(CAMEL_ADDRESS(addr))); - camel_address_cat(CAMEL_ADDRESS(addr2), CAMEL_ADDRESS(addr)); - check(camel_address_length(CAMEL_ADDRESS(addr)) == 10); - check(camel_address_length(CAMEL_ADDRESS(addr2)) == 20); - check_unref(addr2, 1); - pull(); - - push("cat + cat + copy"); - addr2 = camel_internet_address_new(); - camel_address_cat(CAMEL_ADDRESS(addr2), CAMEL_ADDRESS(addr)); - test_address_compare(addr, addr2); - camel_address_cat(CAMEL_ADDRESS(addr2), CAMEL_ADDRESS(addr)); - check(camel_address_length(CAMEL_ADDRESS(addr)) == 10); - check(camel_address_length(CAMEL_ADDRESS(addr2)) == 20); - camel_address_copy(CAMEL_ADDRESS(addr2), CAMEL_ADDRESS(addr)); - test_address_compare(addr, addr2); - check_unref(addr2, 1); - pull(); - - push("copy"); - addr2 = camel_internet_address_new(); - camel_address_copy(CAMEL_ADDRESS(addr2), CAMEL_ADDRESS(addr)); - test_address_compare(addr, addr2); - check_unref(addr2, 1); - pull(); - - pull(); - - check_unref(addr, 1); - - camel_test_end(); - - camel_test_start("CamelInternetAddress, I18N"); - - for (i=0;i<ARRAY_LEN(test_lines);i++) { - push("Testing text line %d (%s) '%s'", i, test_lines[i].type, test_lines[i].line); - - addr = camel_internet_address_new(); - - /* first, convert to api format (utf-8) */ - charset = test_lines[i].type; - name = to_utf8(test_lines[i].line, charset); - - push("Address setup"); - camel_internet_address_add(addr, name, "nobody@nowhere.com"); - check(camel_internet_address_get(addr, 0, &real, &where) == TRUE); - check_msg(string_equal(name, real), "name = '%s' real = '%s'", name, real); - check(strcmp(where, "nobody@nowhere.com") == 0); - test_free(name); - - check(camel_internet_address_get(addr, 1, &real, &where) == FALSE); - check(camel_address_length(CAMEL_ADDRESS(addr)) == 1); - pull(); - - push("Address encode/decode"); - enc = camel_address_encode(CAMEL_ADDRESS(addr)); - - addr2 = camel_internet_address_new(); - check(camel_address_decode(CAMEL_ADDRESS(addr2), enc) == 1); - check(camel_address_length(CAMEL_ADDRESS(addr2)) == 1); - - enc2 = camel_address_encode(CAMEL_ADDRESS(addr2)); - check_msg(string_equal(enc, enc2), "enc = '%s' enc2 = '%s'", enc, enc2); - test_free(enc2); - - push("Compare addresses"); - test_address_compare(addr, addr2); - pull(); - check_unref(addr2, 1); - test_free(enc); - pull(); - - /* FIXME: format/unformat arne't guaranteed to be reversible, at least at the moment */ - camel_test_nonfatal("format/unformat not (yet) reversible for all cases"); - - push("Address format/unformat"); - format = camel_address_format(CAMEL_ADDRESS(addr)); - - addr2 = camel_internet_address_new(); - check(camel_address_unformat(CAMEL_ADDRESS(addr2), format) == 1); - check(camel_address_length(CAMEL_ADDRESS(addr2)) == 1); - - format2 = camel_address_format(CAMEL_ADDRESS(addr2)); - check_msg(string_equal(format, format2), "format = '%s\n\tformat2 = '%s'", format, format2); - test_free(format2); - - /* currently format/unformat doesn't handle ,'s and other special chars at all */ - if (camel_address_length(CAMEL_ADDRESS(addr2)) == 1) { - push("Compare addresses"); - test_address_compare(addr, addr2); - pull(); - } - - test_free(format); - pull(); - - camel_test_fatal(); - - check_unref(addr2, 1); - - check_unref(addr, 1); - pull(); - - } - - camel_test_end(); - - camel_test_start("CamelInternetAddress, I18N decode"); - - for (i=0;i<ARRAY_LEN(test_address);i++) { - push("Testing address line %d '%s'", i, test_address[i].addr); - - addr = camel_internet_address_new(); - push("checking decoded"); - check(camel_address_decode(CAMEL_ADDRESS(addr), test_address[i].addr) == test_address[i].count); - format = camel_address_format(CAMEL_ADDRESS(addr)); - check(strcmp(format, test_address[i].utf8) == 0); - test_free(format); - pull(); - - push("Comparing re-encoded output"); - addr2 = CAMEL_INTERNET_ADDRESS(camel_internet_address_new()); - enc = camel_address_encode(CAMEL_ADDRESS(addr)); - check_msg(camel_address_decode(CAMEL_ADDRESS(addr2), enc) == test_address[i].count, "enc = '%s'", enc); - test_free(enc); - test_address_compare(addr, addr2); - check_unref(addr2, 1); - pull(); - - check_unref(addr, 1); - - pull(); - } - - camel_test_end(); - - /* FIXME: Add test of decoding of broken addresses */ - - return 0; -} - - diff --git a/camel/tests/message/test3.c b/camel/tests/message/test3.c deleted file mode 100644 index 0a9683d146..0000000000 --- a/camel/tests/message/test3.c +++ /dev/null @@ -1,199 +0,0 @@ -/* - Multipart. -*/ - -#include "camel-test.h" -#include "messages.h" - -/* for stat */ -#include <sys/stat.h> -#include <unistd.h> -#include <string.h> - -#include <camel/camel-mime-message.h> -#include <camel/camel-stream-fs.h> -#include <camel/camel-stream-mem.h> -#include "camel/camel-multipart.h" - -int main(int argc, char **argv) -{ - CamelMimeMessage *msg, *msg2, *msg3; - CamelMultipart *mp, *mp2; - CamelMimePart *part, *part2, *part3; - - camel_test_init(argc, argv); - - camel_test_start("multipart message"); - - push("building message"); - msg = test_message_create_simple(); - mp = camel_multipart_new(); - - /* Hrm, this should be able to set its own boundary, no? */ - camel_multipart_set_boundary(mp, "_=,.XYZ_Kangaroo_Meat_is_!_ABADF00D"); - check(strcmp(camel_multipart_get_boundary(mp), "_=,.XYZ_Kangaroo_Meat_is_!_ABADF00D") == 0); - - camel_medium_set_content_object((CamelMedium *)msg, (CamelDataWrapper *)mp); - check(camel_multipart_get_number(mp) == 0); - check(camel_multipart_get_part(mp, 0) == NULL); - check(camel_multipart_get_part(mp, 1) == NULL); - - push("adding/removing parts"); - part = camel_mime_part_new(); - test_message_set_content_simple(part, 0, "text/plain", "content part 1", strlen("content part 1")); - camel_multipart_add_part(mp, part); - check(CAMEL_OBJECT(part)->ref_count == 2); - check(camel_multipart_get_number(mp) == 1); - check(camel_multipart_get_part(mp, 0) == part); - check(camel_multipart_get_part(mp, 1) == NULL); - - camel_multipart_remove_part(mp, part); - check(CAMEL_OBJECT(part)->ref_count == 1); - check(camel_multipart_get_number(mp) == 0); - check(camel_multipart_get_part(mp, 0) == NULL); - check(camel_multipart_get_part(mp, 1) == NULL); - - camel_multipart_add_part_at(mp, part, 0); - check(CAMEL_OBJECT(part)->ref_count == 2); - check(camel_multipart_get_number(mp) == 1); - check(camel_multipart_get_part(mp, 0) == part); - check(camel_multipart_get_part(mp, 1) == NULL); - - check(camel_multipart_remove_part_at(mp, 1) == NULL); - check(CAMEL_OBJECT(part)->ref_count == 2); - check(camel_multipart_get_number(mp) == 1); - check(camel_multipart_get_part(mp, 0) == part); - check(camel_multipart_get_part(mp, 1) == NULL); - - check(camel_multipart_remove_part_at(mp, 0) == part); - check(CAMEL_OBJECT(part)->ref_count == 1); - check(camel_multipart_get_number(mp) == 0); - check(camel_multipart_get_part(mp, 0) == NULL); - check(camel_multipart_get_part(mp, 1) == NULL); - - camel_multipart_add_part(mp, part); - check(CAMEL_OBJECT(part)->ref_count == 2); - check(camel_multipart_get_number(mp) == 1); - check(camel_multipart_get_part(mp, 0) == part); - check(camel_multipart_get_part(mp, 1) == NULL); - - part2 = camel_mime_part_new(); - test_message_set_content_simple(part2, 0, "text/plain", "content part 2", strlen("content part 2")); - camel_multipart_add_part(mp, part2); - check(CAMEL_OBJECT(part2)->ref_count == 2); - check(camel_multipart_get_number(mp) == 2); - check(camel_multipart_get_part(mp, 0) == part); - check(camel_multipart_get_part(mp, 1) == part2); - - part3 = camel_mime_part_new(); - test_message_set_content_simple(part3, 0, "text/plain", "content part 3", strlen("content part 3")); - camel_multipart_add_part_at(mp, part3, 1); - check(CAMEL_OBJECT(part3)->ref_count == 2); - check(camel_multipart_get_number(mp) == 3); - check(camel_multipart_get_part(mp, 0) == part); - check(camel_multipart_get_part(mp, 1) == part3); - check(camel_multipart_get_part(mp, 2) == part2); - pull(); - - push("save message to test3.msg"); - unlink("test3.msg"); - test_message_write_file(msg, "test3.msg"); - pull(); - - push("read from test3.msg"); - msg2 = test_message_read_file("test3.msg"); - pull(); - - push("compre content of multipart"); - mp2 = (CamelMultipart *)camel_medium_get_content_object((CamelMedium *)msg2); - check(mp2 != NULL); - check(CAMEL_IS_MULTIPART(mp2)); - check(camel_multipart_get_number(mp2) == 3); - - check(strcmp(camel_multipart_get_boundary(mp2), "_=,.XYZ_Kangaroo_Meat_is_!_ABADF00D") == 0); - check(mp2->preface == NULL || strlen(mp2->preface) == 0); - - /* FIXME */ - camel_test_nonfatal("postface may gain a single \\n?"); - check_msg(mp2->postface == NULL || strlen(mp2->postface) == 0, "postface: '%s'", mp2->postface); - camel_test_fatal(); - - test_message_compare_content(camel_medium_get_content_object(CAMEL_MEDIUM(camel_multipart_get_part(mp2, 0))), - "content part 1", strlen("content part 1")); - test_message_compare_content(camel_medium_get_content_object(CAMEL_MEDIUM(camel_multipart_get_part(mp2, 1))), - "content part 3", strlen("content part 3")); - test_message_compare_content(camel_medium_get_content_object(CAMEL_MEDIUM(camel_multipart_get_part(mp2, 2))), - "content part 2", strlen("content part 2")); - pull(); - - push("writing again, & re-reading"); - unlink("test3-2.msg"); - test_message_write_file(msg2, "test3-2.msg"); - msg3 = test_message_read_file("test3-2.msg"); - - push("comparing again"); - mp2 = (CamelMultipart *)camel_medium_get_content_object((CamelMedium *)msg3); - check(mp2 != NULL); - check(CAMEL_IS_MULTIPART(mp2)); - check(camel_multipart_get_number(mp2) == 3); - - check(strcmp(camel_multipart_get_boundary(mp2), "_=,.XYZ_Kangaroo_Meat_is_!_ABADF00D") == 0); - check(mp2->preface == NULL || strlen(mp2->preface) == 0); - - /* FIXME */ - camel_test_nonfatal("postface may gain a single \\n?"); - check_msg(mp2->postface == NULL || strlen(mp2->postface) == 0, "postface: '%s'", mp2->postface); - camel_test_fatal(); - - test_message_compare_content(camel_medium_get_content_object(CAMEL_MEDIUM(camel_multipart_get_part(mp2, 0))), - "content part 1", strlen("content part 1")); - test_message_compare_content(camel_medium_get_content_object(CAMEL_MEDIUM(camel_multipart_get_part(mp2, 1))), - "content part 3", strlen("content part 3")); - test_message_compare_content(camel_medium_get_content_object(CAMEL_MEDIUM(camel_multipart_get_part(mp2, 2))), - "content part 2", strlen("content part 2")); - pull(); - pull(); - - check_unref(msg2, 1); - check_unref(msg3, 1); - - push("testing pre/post text"); - camel_multipart_set_preface(mp, "pre-text\nLines."); - camel_multipart_set_postface(mp, "post-text, no lines.\nOne line.\n"); - - check(strcmp(mp->preface, "pre-text\nLines.") == 0); - check(strcmp(mp->postface, "post-text, no lines.\nOne line.\n") == 0); - - push("writing /re-reading"); - unlink("test3-3.msg"); - test_message_write_file(msg, "test3-3.msg"); - msg2 = test_message_read_file("test3-3.msg"); - - mp2 = (CamelMultipart *)camel_medium_get_content_object((CamelMedium *)msg2); - check(mp2 != NULL); - check(CAMEL_IS_MULTIPART(mp2)); - check(camel_multipart_get_number(mp2) == 3); - - check(strcmp(camel_multipart_get_boundary(mp2), "_=,.XYZ_Kangaroo_Meat_is_!_ABADF00D") == 0); - check(strcmp(mp2->preface, "pre-text\nLines.") == 0); - check(strcmp(mp2->postface, "post-text, no lines.\nOne line.\n") == 0); - test_message_compare_content(camel_medium_get_content_object(CAMEL_MEDIUM(camel_multipart_get_part(mp2, 0))), - "content part 1", strlen("content part 1")); - test_message_compare_content(camel_medium_get_content_object(CAMEL_MEDIUM(camel_multipart_get_part(mp2, 1))), - "content part 3", strlen("content part 3")); - test_message_compare_content(camel_medium_get_content_object(CAMEL_MEDIUM(camel_multipart_get_part(mp2, 2))), - "content part 2", strlen("content part 2")); - pull(); - check_unref(msg2, 1); - pull(); - - check_unref(msg, 1); - check_unref(mp, 1); - check_unref(part, 1); - check_unref(part2, 1); - check_unref(part3, 1); - - camel_test_end(); - - return 0; -} diff --git a/camel/tests/mime-filter/.cvsignore b/camel/tests/mime-filter/.cvsignore deleted file mode 100644 index f8d627b581..0000000000 --- a/camel/tests/mime-filter/.cvsignore +++ /dev/null @@ -1,8 +0,0 @@ -.deps -Makefile -Makefile.in -.libs -*.lo -*.la -test-crlf -test-charset
\ No newline at end of file diff --git a/camel/tests/mime-filter/Makefile.am b/camel/tests/mime-filter/Makefile.am deleted file mode 100644 index 21635f839f..0000000000 --- a/camel/tests/mime-filter/Makefile.am +++ /dev/null @@ -1,36 +0,0 @@ - -INCLUDES = \ - -I$(includedir) \ - -I$(top_srcdir) \ - -I$(top_srcdir)/intl \ - -I$(top_srcdir)/e-util \ - -I$(top_srcdir)/camel \ - -I$(top_srcdir)/camel/tests/lib \ - -DG_LOG_DOMAIN=\"evolution-tests\" \ - -DSOURCEDIR=\"$(srcdir)\" \ - $(CAMEL_CFLAGS) - -LDADD = \ - $(top_builddir)/camel/libcamel.la \ - $(top_builddir)/e-util/libeutil.la \ - $(top_builddir)/camel/tests/lib/libcameltest.a \ - $(INTLLIBS) \ - $(EVOLUTION_MAIL_LIBS) - -EXTRA_DIST = \ - crlf-1.in \ - crlf-1.out \ - charset-iso-2022-jp.0.in \ - charset-iso-2022-jp.0.out \ - charset-gb2312.0.in \ - charset-gb2312.0.out - -check_PROGRAMS = \ - test-crlf \ - test-charset \ - test-tohtml - -TESTS = test-crlf test-charset test-tohtml - - - diff --git a/camel/tests/mime-filter/charset-gb2312.0.in b/camel/tests/mime-filter/charset-gb2312.0.in deleted file mode 100644 index 82520ac916..0000000000 --- a/camel/tests/mime-filter/charset-gb2312.0.in +++ /dev/null @@ -1,448 +0,0 @@ -<html><head> -<meta http-equiv="Content-Type" content="text/html; charset=gb2312"> -<meta name="GENERATOR" content="Microsoft FrontPage 5.0"> -<meta name="ProgId" content="FrontPage.Editor.Document"> -<title>ҝ՞ʽľÄĂłŇץ˘żâ´ćź°ťáźĆšÜŔíϾͳ An all-in-one solution for trading, inventory, accounting management</title> - - -<style> -<!-- -#fps0 {font-style: normal} -#fps1 {background-color: #339933} -#fps2 {font-family:times new roman;font-size:24pt;color:#0066ff;} -#fps3 {font-family:times new roman;font-size:18pt;color:#0066ff;} -#fps4 {font-family:SimSun;font-size:14pt} -#fps5 {color:#0066ff;font-weight:bold;} -#fps6 {font-size:10pt;} -#fps7 {color:#ffffff;} -#fps8 {font-family:times new roman;color:#ffffff;font-weight:bold;} -#fps9 {font-family:times new roman;font-size:10pt;} -#fps10 {font-size:10pt;color:#0066ff;} ---> -</style> - -</head> - -<body topmargin="0" leftmargin="10" bgcolor="#FFFFFF" > - <table border=0 cellpadding=0 cellspacing=0 style="border-collapse: collapse" bordercolor=#111111 id=AutoNumber1 height=233> - <tr valign=top> - <td height=165> - <p align=justify> - - - <em id=fps0> - <strong> - <span id=fps2>TRADE</span><span id=fps3>dot</span><span id=fps2>NET</span></strong></em><span lang=zh-tw><!----><span id=fps4> </span> - </span><font color=#FF0000> - <strong><font size=2> <br> - </font></strong></font><font face=SimSun size=2>ĘÇҝ՞ʽľÄĂłŇץ˘żâ´ćź°ťáźĆšÜŔíϾͳŁŹÖúÄúžŤźňÖÜśř¸´ĘźľÄ×ĘÁĎĘäČ륢ĘýžÝ´ŚŔíź°¸÷Ŕ๨źŰĄ˘ˇ˘ĆąĄ˘´ć˛ÖĄ˘ČŐźÇŐĘĄ˘´ŤĆąĄ˘ą¨ąíľČËůĐčľÄÎÄźţĐĐŐţš¤×÷ŁŹČĂÄú¸üÓĐЧľŘšÜŔíĂłŇץ˘żâ´ćź°ťáźĆĘÂÎńĄŁ</font></td> - <td height=165> - <p align=justify> - - - <em id=fps0> - <strong> - <span id=fps2>TRADE</span><span id=fps3>dot</span><span id=fps2>NET</span></strong></em><span lang=zh-tw><!----><span id=fps4> </span> - </span><font size=2><!----><font color=#FF0000> - <strong> <br> - <font face="Times New Roman">What's the most annoying part during your - work? </font> - </strong></font><font face="Times New Roman">Endless repetitive data - entry, calculation and paper work on quotation, invoice, inventory - management, daily voucher, journal and reporting? Once you have installed<span id=fps5> - TRADEdotNET</span>,<span id=fps5> </span>all of these - annoying work will never appear in your office again!<span id=fps5><br> - TRADEdotNET</span> is an all-in-one solution for trading, inventory, - accounting management. In the <span id=fps5>TRADEdotNET</span> - environment, all data can be continuously retrieved and reused. This will - help you for minimizing time consumed on data entry and enhancing - efficiency.</font></font></td> - </tr> - <tr valign=top> - <td height=68><em id=fps0> - <strong> - <span id=fps2>TRADE</span><span id=fps3>dot</span><span id=fps2>NET</span></strong></em><span lang=zh-tw><!----><span id=fps4> </span> - </span>ˇÖąđÓÉ<span lang=zh-tw>Čý</span>×éϾͳ×éłÉŁşĂłŇלŠľĽšÜŔí<font face=SimSun>Ą˘żâ´ć</font>šÜŔíź°ťáźĆϾͳ</td> - <td height=68><em id=fps0> - <strong> - <span id=fps2>TRADE</span><span id=fps3>dot</span><span id=fps2>NET</span></strong></em><span lang=zh-tw><!----><span id=fps4> </span> - </span><font face="Times New Roman">Containing Trading Management - Module, Inventory Management Module and Accounting Management Module.</font></td> - </tr> - </table> - <p align=center><span id=fps6> - <img border=0 src=Flow2.gif width=600 height=420></span></p> - <table border=0 cellpadding=0 cellspacing=0 style="border-collapse: collapse" bordercolor=#111111 id=AutoNumber2 height=15> - <tr valign=top> - <td height=129> - <em id=fps0> - <strong> - <span id=fps2>TRADE</span><span id=fps3>dot</span><span id=fps2>NET</span></strong></em><span lang=zh-tw><!----><span id=fps4> </span> - </span><span id=fps6>ľÄÓĹľă</span><span lang=zh-tw><!----><span id=fps6>Łş</span></span><span id=fps6><br> - </span> - <span id=fps7><!----><span id=fps1><b> źňŇ×ϾͳľÇČë - </b> <span id=fps6> - <br> - </span> - </span></span> <span id=fps6> <br> - źňľĽŇ×Ă÷ľÄ˛Ů×÷Á÷łĚÍźĎÔĘžŐű¸öϾͳľÄÖ÷ŇŞÁ÷łĚŁŹŇýľźÓĂť§ËłŔűÍęłÉÿҝ¸ö˛˝Ö襣ÓĂť§ÖťĐë°´ĎÂÁ÷łĚÍźľÄÍźĎńŁŹź´ĎľÍłżě˝Ýˇ˝Ę˝ŁŹąăżÉ˝řČëĚŘś¨ľÄšŚÄÜťĂ楣</span></td> - <td height=129> - - - <p align=justify> - - - <em id=fps0> - <strong> - <span id=fps2>TRADE</span><span id=fps3>dot</span><span id=fps2>NET</span></strong></em><span lang=zh-tw><!----><span id=fps4> </span> - </span><font size=4 face="Times New Roman">Highlights :</font><span id=fps6><br> - </span> - <font color=#FFFFFF><span id=fps1> - <span id=fps8> Easy Access - </span> <span id=fps6> - <br> - </span> - </span></font> <font size=2> <br> - <span id=fps9>A Road Map showing the user-friendly system - flow guides users throughout all steps. User can click on the menu icons, - which act as shortcuts, and enter into the desired function.</span></font></p> - </td> - </tr> - <tr valign=top> - <td height=135> - <span id=fps7><!----><span id=fps1><b> ÍęÉƾIJéŃŻËŃŃ°Ć÷ - </b> <span id=fps6> - <br> - </span> - </span></span> <span id=fps6> - <br> - ľąÔąš¤ťŘ´đżÍť§˛éŃŻťňˇ˘łöśŠľĽŁŹžłŁĐčĘąˇ˛éŇÔÍů˝ťŇןÍÂźŁŹŐâ¸öšýłĚ˛ť˝öŔˡŃĘąźäŁŹÍňŇťťŘ´đ˛ť×źČˇŁŹ¸üżÉÄÜÁîÄú´Ó´ËʧȼŐ⹌šóľÄżÍť§ĄŁ˛éŃŻËŃŃ°Ć÷śŕÖÖ˛ťÍŹľÄʾʹ˛éŃŻšŚÄÜŁŹÄÜżěËŮËŃŃ°ËůĐčľÄĘýžÝźÍÂźŁŹÖťŇŞÓĂť§ĘäČëżÍť§ąŕşĹĄ˘ťőơąŕşĹĄ˘ˇ˘ĆąČŐĆÚľČĆäÖĐŇťĎîËŃŃ°˛ÎĘýŁŹËŃŃ°˝ášűËćź´ĎÔĘžĄŁ </span> - </td> - <td height=135> - <font color=#FFFFFF><span id=fps1> - <span id=fps8> Perfect On-line Enquiry - </span> <span id=fps6> - <br> - </span> - </span></font> <font size=2> - <br> - <span id=fps9>Under many circumstances, staff also need to - retrieve past transaction history for handing customer enquiry or placing - an order, however they cannot get the required information immediately and - this may drive away the customers. On-line Enquiry engine enables staff to - check past transaction with searching parameters such as key words, client - code, item code, invoice date. </span> - </font></td> - </tr> - <tr valign=top> - <td height=83> - <span style="background-color: #339933; font-weight:700" id="fps7"> ÎÄźţĘäČë </span><span id=fps6> - <br> - <br> - ϾͳľÄ×ÜŐʽӿÚÉčźĆŇÔłŁÓþĴŤĆąÎŞŔśąžŁŹÓĂť§ÎŢĐčˇŃĘąÖŘĐÂĘĘÓŚ˛ťÍŹČŐźÇŐʸńĘ˝ŁŹśřÇŇÄܸüÓĐЧÂʾشŚŔíČŐłŁťáźĆŐĘĎîĘýžÝĘäČëłĚĐňĄŁ</span></td> - <td height=83> - <font color=#FFFFFF face="Times New Roman"> - <span style="background-color: #339933; font-weight:700"> Input - Template </span></font><font size=2> - <br> - <br> - <span id=fps9>The data entry journal interface is similar - to paper voucher, so that users can handle their daily accounting - transaction as they used to, yet more efficient.</span></font></td> - </tr> - <tr valign=top> - <td height=76> - <b> - <font color=#FFFFFF><span id=fps1> ÎŢĎŢźÍÂź´˘´ć </span></font> </b><font size=2><br> - <br> - ϾͳČÝÁżÇż´óŁŹ˛ťÉčźÍÂź´˘´ćÄęĆÚÉĎĎŢŁŹŇň´ËÓĂť§żÉŇÔËćĘą˛éÔÄČÎşÎĘąĆھĽťŇןÍÂźĄŁ - </font> - </td> - <td height=76> - <font face="Times New Roman"> - <b> - <font color=#FFFFFF><span id=fps1> Unlimited - Data Record </span></font> </b></font><font size=2><br> - <br> - <font face="Times New Roman">The system can store unlimited number of - records, so that users can retrieve data of any time whenever they need - it.</font></font></td> - </tr> - <tr valign=top> - <td height=105> - <span id=fps7><!----><span id=fps1><b> ϾͳľÇČëźŕżŘ - </b> <br> - </span></span> <span id=fps6> - <br> - ĎČ˝řľÄľÇČëźŕżŘϾͳąŁŐĎ(ťúĂÜ)ĘýžÝÖťšŠĘÚȨÓĂť§˛éÔÄŁŹĎľÍłšÜŔíÔąŇŕżÉŇÔŇňÓŚÓĂť§ľÄÖ°źśśřÉ蜨¸öąđÓĂť§ľÄÔÄŔŔȨĎŢĄŁ </span></td> - <td height=105> - <font color=#FFFFFF><span id=fps1> - <span id=fps8> Login Control - </span> <br> - </span></font> <font size=2> - <br> - <span id=fps9>Advanced access control ensures access right - is only granted to authorized users. System administrator can also define - access level of each user according to their capacity, so that confidential - information can only be retrieved and viewed by senior management.</span></font></td> - </tr> - <tr valign=top> - <td height=87> - <span id=fps7><!----><span id=fps1><b> ×ÔŃĄą¨ąí¸ńĘ˝ - </b> <br> - </span></span> <span id=fps6> - <br> - Ͼͳą¨ąíŇÔżŞˇĹĘ˝ÉčźĆŁŹÖťĐčŇŞĹäşĎSeagate Crystal Report (Áíšş)ŁŹź´żÉ×ÔĐĐÉčźĆą¨ąí¸ńĘ˝ťňÔöźÓą¨ąíĄŁ</span></td> - <td height=87> - <font color=#FFFFFF><span id=fps1> - <span id=fps8> Customize Report - </span> <br> - </span></font> <font size=2> - <br> - <span id=fps9>The system is designed with an open architecture - format. When the system is used with Seagate Crystal Report Software, Users can - customize report content and format of the system.</span></font></td> - </tr> - <tr valign=top> - <td height=100> - <font color=#FFFFFF><span id=fps1> - <b> śŕĎňÁĐ
ną¨ąíš¤žß <br> - </b> - </span></font> <span id=fps6> - <br> - łŹšý80%ľÄą¨ąíżÉŇÔMS Excel/Word¸ńĘ˝ĘäłöŁŹ°´ĐčŇŞśřÖĆ×÷ÍźąíšŠĘýžÝˇÖÎöÖŽÓĂĄŁ <br> - ą¨ąíżÉŇÔMS Excel/WordľČ¸ńĘ˝śŔÁ˘ĘäłöťňŇÔľçÓʸ˝´ř´ŤË͸řÓĐšŘČËÔąĄŁ </span></td> - <td height=100> - <font color=#FFFFFF><span id=fps1> - <b><font face="Times New Roman"> Multi-Report Export Tools </font> <br> - </b> - </span></font> <font size=2> - <br> - <font face="Times New Roman">Over 80% of reports can be exported to MS - Excel / Word and data can be translated into graphs and tables for - further analysis.<br> - Reports can also be export to MS Excel / Word format independently or send - to email client with attachment directly.</font></font></td> - </tr> - <tr valign=top> - <td height=118> - <span id=fps7><!----><span id=fps1><b> šúźĘťĽÁŞÖ§łÖ - </b> <br> - </span> - </span> <span id=fps6> - <br> - ÎŞÁËĹäşĎ˛ťÉŮĂłŇךŤËžÓÚšúÄÚťňśŤÄĎŃÇÉ賧ťňˇÖšŤËžśřĐčŇŞĘýžÝĘýžÝťĽÍ¨ŁŹ</span><strong><font size=2><span id=fps10>TRADEdotNET</span><font color=#FF0000> </font> - </font></strong> - <span id=fps6>ĚᚊȍĂ氲ȍľÄŐűşĎƽ̨ŁŹ°˛×°</span><font color=#0066FF><strong><span id=fps10> TRADEdotNET </span></strong></font><span id=fps6>ťĽÁŞÍřÖ§łÖ¸˝źţŁŹÍ¸šýťĽÁŞÍřŁŹÓĂť§ź´żÉËćĘąËćľŘŇÔ°˛×°ÁË </span><strong><font size=2> - <span id=fps10>TRADEdotNET</span><font color=#FF0000> </font> - </font></strong> - <span id=fps6>ľÄąęן MS ˛Ů×÷ϾͳľÇČëĘšÓĂĄŁ</span></td> - <td height=118> - <font color=#FFFFFF><span id=fps1> - <span id=fps8> Internet Ready - </span> <br> - </span> - </font> <font size=2> - <br> - <span id=fps9>To facilitate data exchange between trading companies and their offices in - the Mainland China or Southeast Asia Country, </span> </font> - <font face="Times New Roman"> <span id=fps9> - Install and makes use of<strong><font color=#0066FF> TRADEdotNET</font> - Internet Kit </strong> to provide a secured platform enabling user - to access the data from different locations anytime through the internet - with </span><font color=#0066FF><strong><span id=fps10> TRADEdotNET </span></strong></font> - </font> - <span id=fps9>system. </span></td> - </tr> - <tr valign=top> - <td height=90> - <span id=fps7><!----><span id=fps1><b> śŕÖÖĘýžÝżâÖ§łÖ - </b> <br> - </span> - </span> <span id=fps6> - <br> - ÎŞÁËĹäşĎ˛ťÍŹ´óĐĄšŤËžľÄąžÉíĐčŇŞŁŹ</span><strong><span id=fps10>TRADEdotNET</span></strong><span id=fps6> Ěᚊ˛ťÍŹĘýžÝżâ°ćąžŇÔšŠŃĄÔńĄŁŇŃÍĆłöÓĐ MS AccessĄ˘MS SQLŁŹź´˝ŤÍĆłöÓĐ Oracle ź°ĆäËüĘýžÝżâĄŁ<br> - ĄĄ</span></td> - <td height=90> - <font color=#FFFFFF><span id=fps1> - <span id=fps8> Multi-Database Format - </span> <br> - </span> - </font> <span id=fps6> - <br> - </span><font face="Times New Roman"><strong><font size=2><!----><font color=#0066FF>TRADEdotNET</font><font color=#FF0000> </font> - </font></strong> - </font><span id=fps9>enables user to select - different database format versions to fit their company requirements. Now - users can choose from MS - Access and MS SQL version. Oracle and other database formats are coming soon.</span></td> - </tr> - <tr valign=top> - <td height=70> - <span id=fps7><!----><span id=fps1><b> ĆäËüÖ§łÖšŚÄÜ - </b> <br> - </span></span> - <span id=fps6> <br> - Ö§łÖśŕÓĂť§ŁŹÖ§łÖśŕšŤËžŁŹÖ§łÖśŕťőąŇŁŹÖ§łÖśŕżâ´ćŁŹÖ§łÖśŕÓďŃÔ(ÖĐÎÄ/Ó˘ÎÄ) - </span></td> - <td height=70> - <font color=#FFFFFF><span id=fps1> - <span id=fps8> Multiple Functionality - </span> <br> - </span></font> - <font size=2> <br> - <span id=fps9>Support multi-users, multi-companies, - multi-currencies, multi-inventory, multi-languages (Chinese / English).</span></font></td> - </tr> - <tr valign=top> - <td height=142> - <span id=fps7> - <span id=fps1> - <b> ϾͳҪÇó - </b> - <br> - </span></span><span id=fps6><br> - š¤×÷̨<br> - Intel Pentium II (ťňŇÔÉĎ) Processor PC<br> - Windows 98, ME, 2000 ťň Windows NT 4.0<br> - ×îÉŮÓĂ 64 MB RAMŁŹÍĆźöÓĂ128MB<br> - 256ÉŤťňŇÔÉĎÖŽSVGAĎÔĘžĆ÷<br> - 50MBÓ˛ĹĚżŐźä<br> - Windows 98, ME, 2000 ťň Windows NT 4.0 Ö§łÖÖŽ´ňÓĄťú</span></td> - <td height=142> - <font color=#FFFFFF> - <span id=fps1> - <span id=fps8> - System - Requirements - - </span> - <br> - </span></font><font size=2><br> - <span id=fps9> - Workstation<br> - Intel Pentium II (or above) Processor PC<br> - Windows 98, ME, 2000 or Windows NT 4.0<br> - 64MB RAM - minimumŁŹ 128MB - recommended<br> - 256 color SVGA display or higher<br> - 50MB free Hard Disk<br> - Printers - supported by - Windows 98, ME, 2000 ťň Windows NT 4.0<br> - ĄĄ</span></font></td> - </tr> - <tr valign=top> - <td height=436> - <span id=fps7> - <span id=fps1> ˇţÎńˇśÎ§ - </span></span><span id=fps6> - <br> - <br> - Ͼͳʞˇś<br> - ĂâˇŃÉĎĂĹ×÷Ͼͳʞˇś - ĄŁ<br> - <br> - Ͼͳ°˛×°<br> - Ͼͳ°˛×°ťáÓÉąžšŤËž×¨Ňľš¤łĚĘŚ¸şÔđ - ĄŁ<br> - <br> - ĘýžÝą¸ˇÝź°ťšÔ<br> - ĂâˇŃÎŞżÍť§É蜨ĘýžÝą¸ˇÝź°ťšÔ°´ĹĽŁŹŇÔĹäşĎżÍť§ÖŽĄŽą¸ˇÝÉ蹸ĄŻĄŁ<br> - <br> - śČÉ휊×öÎÄźţĘ˝Ńů<br> - ÎŞżÍť§śČÉ휊×öÎÄźţĘ˝ŃůŁŹĚá¸ßšŤËžĐÎĎó(ÁíˇŃ)ĄŁ<br> - <br> - ϾͳִĐĐ<br> - ÎŞ¸÷ťúššÉ蜨ϾͳÁ÷łĚąíź°źŕ˛ě¸÷˛żĂĹľÄÖ´ĐĐÇéżö - ĄŁ<br> - <br> - ÓĂť§ĹŕŃľ<br> - ÓĂť§ĹŕŃľżÉÉčÔڿ͝§°ěšŤĘŇŁŹśřÇҲťĎŢ´ÎĘý - ĄŁ<br> - <br> - Ͼͳ×ÉŃŻČČĎß<br> - ĚᚊÓĐЧֹ˝ÓľÄČČĎß×ÉŃŻˇţÎńŁŹ´ŚŔíϾͳŇÉÄŃ - ĄŁ<br> - <br> - ϾͳąŁŃř<br> - °ëÄęĂâˇŃąŁŃř - Łť <br> - ÓÚąŁŃřĆÚÄÚĂâˇŃÎŞżÍť§×÷ϾͳĚáÉý - ĄŁ</span></td> - <td height=436> - <font color=#FFFFFF face="Times New Roman"> - <span id=fps1> Services - Provided - </span></font><font size=2> - <br> - <br> - <span id=fps9>System Demonstration<br> - Free-of-charge system demonstration in client's office<br> - <br> - System Installation<br> - - On-site - installation - by our - professional - engineers <br> - <br> - Backup/Restore<br> - Setups of backup and restore icons associated with client's backup device (e.g. Zip Drive, MO)<br> - <br> - Tailored Format<br> - Tailored designs on document formats to highlight and promote company image<br> - <br> - System Implementation<br> - - Implementation - procedures - customized for - each - organization <br> - <br> - User Training<br> - Unlimited training is provided in the client's office - <br> - <br> - Hot-line Enquiry<br> - Efficient hot-line support for all system enquiries<br> - <br> - System Maintenance<br> - Half-a-year free maintenance <br> - Free - upgrade - services - throughout - warranty - periods </span> - </font> - </td> - </tr> - </table> - <table border=0 cellpadding=0 cellspacing=0 style="border-collapse: collapse" bordercolor=#111111 width=100% id=AutoNumber3> - <tr> - <td width=100%><b><font size=6 color=#FFFFFF> - <span style="background-color: #0000FF"><br> - ťś Ó Ô¤ Ôź Ęž ˇś Çëľç : (852) 2591 9377</span></font></b><p>žŤ Ńś šú źĘ ÓĐ - ĎŢ šŤ Ëž Superdata International Ltd.<br> - Tel: (852) 2591 9377 </td> - </tr> - </table> - <p> - <font size=1> - <font face="Times New Roman"> - *All prices, - conditions and - system - specifications - are subject to - change without - prior notice. - </font>ËůÓП۸ńŁŹĚőšćź°ĎľÍłšć¸ńÖŽĐ޸ģŹ˝Ť˛ťÁíĐĐ֪ͨĄŁ</font><span id=fps6> - -ĄĄ</span> </p> - - </body></html> diff --git a/camel/tests/mime-filter/charset-gb2312.0.out b/camel/tests/mime-filter/charset-gb2312.0.out deleted file mode 100644 index 8dcae6bdfc..0000000000 --- a/camel/tests/mime-filter/charset-gb2312.0.out +++ /dev/null @@ -1,448 +0,0 @@ -<html><head> -<meta http-equiv="Content-Type" content="text/html; charset=gb2312"> -<meta name="GENERATOR" content="Microsoft FrontPage 5.0"> -<meta name="ProgId" content="FrontPage.Editor.Document"> -<title>ä¸çŤĺźçč´¸ćăĺşĺĺäźčŽĄçŽĄççłťçť An all-in-one solution for trading, inventory, accounting management</title> - - -<style> -<!-- -#fps0 {font-style: normal} -#fps1 {background-color: #339933} -#fps2 {font-family:times new roman;font-size:24pt;color:#0066ff;} -#fps3 {font-family:times new roman;font-size:18pt;color:#0066ff;} -#fps4 {font-family:SimSun;font-size:14pt} -#fps5 {color:#0066ff;font-weight:bold;} -#fps6 {font-size:10pt;} -#fps7 {color:#ffffff;} -#fps8 {font-family:times new roman;color:#ffffff;font-weight:bold;} -#fps9 {font-family:times new roman;font-size:10pt;} -#fps10 {font-size:10pt;color:#0066ff;} ---> -</style> - -</head> - -<body topmargin="0" leftmargin="10" bgcolor="#FFFFFF" > - <table border=0 cellpadding=0 cellspacing=0 style="border-collapse: collapse" bordercolor=#111111 id=AutoNumber1 height=233> - <tr valign=top> - <td height=165> - <p align=justify> - - - <em id=fps0> - <strong> - <span id=fps2>TRADE</span><span id=fps3>dot</span><span id=fps2>NET</span></strong></em><span lang=zh-tw><!----><span id=fps4> </span> - </span><font color=#FF0000> - <strong><font size=2> <br> - </font></strong></font><font face=SimSun size=2>ćŻä¸çŤĺźçč´¸ćăĺşĺĺäźčŽĄçŽĄççłťçťďźĺŠć¨ç˛žçŽĺ¨čĺ¤ĺ§çčľćčžĺ
Ľăć°ćŽĺ¤çĺĺçąťćĽäťˇăĺ缨ăĺäťăćĽčŽ°ĺ¸ăäź çĽ¨ăćĽčĄ¨çćéçćäťśčĄćżĺˇĽä˝ďźčŽŠć¨ć´ććĺ°çŽĄçč´¸ćăĺşĺĺäźčŽĄäşĺĄă</font></td> - <td height=165> - <p align=justify> - - - <em id=fps0> - <strong> - <span id=fps2>TRADE</span><span id=fps3>dot</span><span id=fps2>NET</span></strong></em><span lang=zh-tw><!----><span id=fps4> </span> - </span><font size=2><!----><font color=#FF0000> - <strong> <br> - <font face="Times New Roman">What's the most annoying part during your - work? </font> - </strong></font><font face="Times New Roman">Endless repetitive data - entry, calculation and paper work on quotation, invoice, inventory - management, daily voucher, journal and reporting? Once you have installed<span id=fps5> - TRADEdotNET</span>,<span id=fps5> </span>all of these - annoying work will never appear in your office again!<span id=fps5><br> - TRADEdotNET</span> is an all-in-one solution for trading, inventory, - accounting management. In the <span id=fps5>TRADEdotNET</span> - environment, all data can be continuously retrieved and reused. This will - help you for minimizing time consumed on data entry and enhancing - efficiency.</font></font></td> - </tr> - <tr valign=top> - <td height=68><em id=fps0> - <strong> - <span id=fps2>TRADE</span><span id=fps3>dot</span><span id=fps2>NET</span></strong></em><span lang=zh-tw><!----><span id=fps4> </span> - </span>ĺĺŤçą<span lang=zh-tw>ä¸</span>çťçłťçťçťćďźč´¸ć莢ĺ玥ç<font face=SimSun>ăĺşĺ</font>玥çĺäźčŽĄçłťçť</td> - <td height=68><em id=fps0> - <strong> - <span id=fps2>TRADE</span><span id=fps3>dot</span><span id=fps2>NET</span></strong></em><span lang=zh-tw><!----><span id=fps4> </span> - </span><font face="Times New Roman">Containing Trading Management - Module, Inventory Management Module and Accounting Management Module.</font></td> - </tr> - </table> - <p align=center><span id=fps6> - <img border=0 src=Flow2.gif width=600 height=420></span></p> - <table border=0 cellpadding=0 cellspacing=0 style="border-collapse: collapse" bordercolor=#111111 id=AutoNumber2 height=15> - <tr valign=top> - <td height=129> - <em id=fps0> - <strong> - <span id=fps2>TRADE</span><span id=fps3>dot</span><span id=fps2>NET</span></strong></em><span lang=zh-tw><!----><span id=fps4> </span> - </span><span id=fps6>çäźçš</span><span lang=zh-tw><!----><span id=fps6>ďź</span></span><span id=fps6><br> - </span> - <span id=fps7><!----><span id=fps1><b> çŽćçłťçťçťĺ
Ľ - </b> <span id=fps6> - <br> - </span> - </span></span> <span id=fps6> <br> - çŽĺććçćä˝ćľç¨ĺžćžç¤şć´ä¸Şçłťçťç丝čŚćľç¨ďźĺźĺŻźç¨ćˇéĄşĺŠĺŽććŻä¸ä¸ŞćĽéޤăç¨ćˇĺŞéĄťćä¸ćľç¨ĺžçĺžĺďźĺłçłťçťĺżŤćˇćšĺźďźäžżĺŻčżĺ
ĽçšĺŽçĺč˝çťé˘ă</span></td> - <td height=129> - - - <p align=justify> - - - <em id=fps0> - <strong> - <span id=fps2>TRADE</span><span id=fps3>dot</span><span id=fps2>NET</span></strong></em><span lang=zh-tw><!----><span id=fps4> </span> - </span><font size=4 face="Times New Roman">Highlights :</font><span id=fps6><br> - </span> - <font color=#FFFFFF><span id=fps1> - <span id=fps8> Easy Access - </span> <span id=fps6> - <br> - </span> - </span></font> <font size=2> <br> - <span id=fps9>A Road Map showing the user-friendly system - flow guides users throughout all steps. User can click on the menu icons, - which act as shortcuts, and enter into the desired function.</span></font></p> - </td> - </tr> - <tr valign=top> - <td height=135> - <span id=fps7><!----><span id=fps1><b> ĺŽĺçćĽčŻ˘ćĺŻťĺ¨ - </b> <span id=fps6> - <br> - </span> - </span></span> <span id=fps6> - <br> - ĺ˝ĺ塼ĺç厢ćˇćĽčŻ˘ćĺĺşčŽ˘ĺďźçťĺ¸¸éćśçżťćĽäťĽĺžäş¤ć纪ĺ˝ďźčżä¸Şčżç¨ä¸äť
澪贚ćśé´ďźä¸ä¸ĺçä¸ĺ祎ďźć´ĺŻč˝äť¤ć¨äťć¤ĺ¤ąĺťčżĺŽč´ľç厢ćˇăćĽčŻ˘ć寝ĺ¨ĺ¤ç§ä¸ĺçĺŽćśćĽčŻ˘ĺč˝ďźč˝ĺżŤéć寝ćéçć°ćŽçşŞĺ˝ďźĺŞčŚç¨ćˇčžĺ
ĽĺŽ˘ćˇçźĺˇăč´§ĺçźĺˇăĺ缨ćĽćçĺ
śä¸ä¸éĄšć寝ĺć°ďźć寝çťćéĺłćžç¤şă </span> - </td> - <td height=135> - <font color=#FFFFFF><span id=fps1> - <span id=fps8> Perfect On-line Enquiry - </span> <span id=fps6> - <br> - </span> - </span></font> <font size=2> - <br> - <span id=fps9>Under many circumstances, staff also need to - retrieve past transaction history for handing customer enquiry or placing - an order, however they cannot get the required information immediately and - this may drive away the customers. On-line Enquiry engine enables staff to - check past transaction with searching parameters such as key words, client - code, item code, invoice date. </span> - </font></td> - </tr> - <tr valign=top> - <td height=83> - <span style="background-color: #339933; font-weight:700" id="fps7"> ćäťśčžĺ
Ľ </span><span id=fps6> - <br> - <br> - çłťçťçćťĺ¸ćĽĺŁčŽžčŽĄäťĽĺ¸¸ç¨çäź çĽ¨ä¸şčćŹďźç¨ćˇć éč´šćśéć°éĺşä¸ĺćĽčŽ°ĺ¸ć źĺźďźčä¸č˝ć´ććçĺ°ĺ¤çćĽĺ¸¸äźčŽĄĺ¸éĄšć°ćŽčžĺ
Ľç¨ĺşă</span></td> - <td height=83> - <font color=#FFFFFF face="Times New Roman"> - <span style="background-color: #339933; font-weight:700"> Input - Template </span></font><font size=2> - <br> - <br> - <span id=fps9>The data entry journal interface is similar - to paper voucher, so that users can handle their daily accounting - transaction as they used to, yet more efficient.</span></font></td> - </tr> - <tr valign=top> - <td height=76> - <b> - <font color=#FFFFFF><span id=fps1> ć é纪ĺ˝ĺ¨ĺ </span></font> </b><font size=2><br> - <br> - çłťçťĺŽšé基大ďźä¸čŽžçşŞĺ˝ĺ¨ĺĺš´ćä¸éďźĺ ć¤ç¨ćˇĺŻäťĽéćśćĽé
äťťä˝ćśćç交ć纪ĺ˝ă - </font> - </td> - <td height=76> - <font face="Times New Roman"> - <b> - <font color=#FFFFFF><span id=fps1> Unlimited - Data Record </span></font> </b></font><font size=2><br> - <br> - <font face="Times New Roman">The system can store unlimited number of - records, so that users can retrieve data of any time whenever they need - it.</font></font></td> - </tr> - <tr valign=top> - <td height=105> - <span id=fps7><!----><span id=fps1><b> çłťçťçťĺ
Ľçć§ - </b> <br> - </span></span> <span id=fps6> - <br> - ĺ
čżççťĺ
Ľçć§çłťçťäżé(ćşĺŻ)ć°ćŽĺŞäžććç¨ćˇćĽé
ďźçłťçťçŽĄçĺ二ĺŻäťĽĺ ĺşç¨ćˇçč级č莞ĺŽä¸ŞĺŤç¨ćˇçé
č§ćéă </span></td> - <td height=105> - <font color=#FFFFFF><span id=fps1> - <span id=fps8> Login Control - </span> <br> - </span></font> <font size=2> - <br> - <span id=fps9>Advanced access control ensures access right - is only granted to authorized users. System administrator can also define - access level of each user according to their capacity, so that confidential - information can only be retrieved and viewed by senior management.</span></font></td> - </tr> - <tr valign=top> - <td height=87> - <span id=fps7><!----><span id=fps1><b> čŞéćĽčĄ¨ć źĺź - </b> <br> - </span></span> <span id=fps6> - <br> - çłťçťćĽčĄ¨äťĽĺźćžĺźčŽžčŽĄďźĺŞéčŚé
ĺSeagate Crystal Report (ĺŚč´)ďźĺłĺŻčŞčĄčŽžčŽĄćĽčĄ¨ć źĺźćĺ˘ĺ ćĽčĄ¨ă</span></td> - <td height=87> - <font color=#FFFFFF><span id=fps1> - <span id=fps8> Customize Report - </span> <br> - </span></font> <font size=2> - <br> - <span id=fps9>The system is designed with an open architecture - format. When the system is used with Seagate Crystal Report Software, Users can - customize report content and format of the system.</span></font></td> - </tr> - <tr valign=top> - <td height=100> - <font color=#FFFFFF><span id=fps1> - <b> ĺ¤ĺĺnćĽčĄ¨ĺˇĽĺ
ˇ <br> - </b> - </span></font> <span id=fps6> - <br> - čś
čż80%çćĽčĄ¨ĺŻäťĽMS Excel/Wordć źĺźčžĺşďźćéčŚčĺśä˝ĺžčĄ¨äžć°ćŽĺćäšç¨ă <br> - ćĽčĄ¨ĺŻäťĽMS Excel/Wordçć źĺźçŹçŤčžĺşć䝼çľéŽéĺ¸Śäź éçťćĺ
łäşşĺă </span></td> - <td height=100> - <font color=#FFFFFF><span id=fps1> - <b><font face="Times New Roman"> Multi-Report Export Tools </font> <br> - </b> - </span></font> <font size=2> - <br> - <font face="Times New Roman">Over 80% of reports can be exported to MS - Excel / Word and data can be translated into graphs and tables for - further analysis.<br> - Reports can also be export to MS Excel / Word format independently or send - to email client with attachment directly.</font></font></td> - </tr> - <tr valign=top> - <td height=118> - <span id=fps7><!----><span id=fps1><b> ĺ˝é
äşčćŻć - </b> <br> - </span> - </span> <span id=fps6> - <br> - 为äşé
ĺä¸ĺ°č´¸ćĺ
Źĺ¸äşĺ˝ĺ
ćä¸ĺäşčŽžĺćĺĺ
Źĺ¸čéčŚć°ćŽć°ćŽäşéďź</span><strong><font size=2><span id=fps10>TRADEdotNET</span><font color=#FF0000> </font> - </font></strong> - <span id=fps6>ćäžĺ
¨é˘ĺŽĺ
¨çć´ĺĺšłĺ°ďźĺŽčŁ
</span><font color=#0066FF><strong><span id=fps10> TRADEdotNET </span></strong></font><span id=fps6>äşčç˝ćŻćéäťśďźéčżäşčç˝ďźç¨ćˇĺłĺŻéćśéĺ°äťĽĺŽčŁ
äş </span><strong><font size=2> - <span id=fps10>TRADEdotNET</span><font color=#FF0000> </font> - </font></strong> - <span id=fps6>çć ĺ MS ćä˝çłťçťçťĺ
Ľä˝żç¨ă</span></td> - <td height=118> - <font color=#FFFFFF><span id=fps1> - <span id=fps8> Internet Ready - </span> <br> - </span> - </font> <font size=2> - <br> - <span id=fps9>To facilitate data exchange between trading companies and their offices in - the Mainland China or Southeast Asia Country, </span> </font> - <font face="Times New Roman"> <span id=fps9> - Install and makes use of<strong><font color=#0066FF> TRADEdotNET</font> - Internet Kit </strong> to provide a secured platform enabling user - to access the data from different locations anytime through the internet - with </span><font color=#0066FF><strong><span id=fps10> TRADEdotNET </span></strong></font> - </font> - <span id=fps9>system. </span></td> - </tr> - <tr valign=top> - <td height=90> - <span id=fps7><!----><span id=fps1><b> ĺ¤ç§ć°ćŽĺşćŻć - </b> <br> - </span> - </span> <span id=fps6> - <br> - 为äşé
ĺä¸ĺ大ĺ°ĺ
Źĺ¸çćŹčşŤéčŚďź</span><strong><span id=fps10>TRADEdotNET</span></strong><span id=fps6> ćäžä¸ĺć°ćŽĺşçćŹäťĽäžéćŠă塲ć¨ĺşć MS AccessăMS SQLďźĺłĺ°ć¨ĺşć Oracle ĺĺ
śĺŽć°ćŽĺşă<br> - ă</span></td> - <td height=90> - <font color=#FFFFFF><span id=fps1> - <span id=fps8> Multi-Database Format - </span> <br> - </span> - </font> <span id=fps6> - <br> - </span><font face="Times New Roman"><strong><font size=2><!----><font color=#0066FF>TRADEdotNET</font><font color=#FF0000> </font> - </font></strong> - </font><span id=fps9>enables user to select - different database format versions to fit their company requirements. Now - users can choose from MS - Access and MS SQL version. Oracle and other database formats are coming soon.</span></td> - </tr> - <tr valign=top> - <td height=70> - <span id=fps7><!----><span id=fps1><b> ĺ
śĺŽćŻćĺč˝ - </b> <br> - </span></span> - <span id=fps6> <br> - ćŻćĺ¤ç¨ćˇďźćŻćĺ¤ĺ
Źĺ¸ďźćŻćĺ¤č´§ĺ¸ďźćŻćĺ¤ĺşĺďźćŻćĺ¤čŻč¨(ä¸ć/čąć) - </span></td> - <td height=70> - <font color=#FFFFFF><span id=fps1> - <span id=fps8> Multiple Functionality - </span> <br> - </span></font> - <font size=2> <br> - <span id=fps9>Support multi-users, multi-companies, - multi-currencies, multi-inventory, multi-languages (Chinese / English).</span></font></td> - </tr> - <tr valign=top> - <td height=142> - <span id=fps7> - <span id=fps1> - <b> çłťçťčŚćą - </b> - <br> - </span></span><span id=fps6><br> - 塼ä˝ĺ°<br> - Intel Pentium II (ć䝼ä¸) Processor PC<br> - Windows 98, ME, 2000 ć Windows NT 4.0<br> - ćĺ°ç¨ 64 MB RAMďźć¨čç¨128MB<br> - 256č˛ć䝼ä¸äšSVGAćžç¤şĺ¨<br> - 50MB祏ç犺é´<br> - Windows 98, ME, 2000 ć Windows NT 4.0 ćŻćäšćĺ°ćş</span></td> - <td height=142> - <font color=#FFFFFF> - <span id=fps1> - <span id=fps8> - System - Requirements - - </span> - <br> - </span></font><font size=2><br> - <span id=fps9> - Workstation<br> - Intel Pentium II (or above) Processor PC<br> - Windows 98, ME, 2000 or Windows NT 4.0<br> - 64MB RAM - minimumďź 128MB - recommended<br> - 256 color SVGA display or higher<br> - 50MB free Hard Disk<br> - Printers - supported by - Windows 98, ME, 2000 ć Windows NT 4.0<br> - ă</span></font></td> - </tr> - <tr valign=top> - <td height=436> - <span id=fps7> - <span id=fps1> ćĺĄčĺ´ - </span></span><span id=fps6> - <br> - <br> - çłťçťç¤şč<br> - ĺ
č´šä¸é¨ä˝çłťçťç¤şč - ă<br> - <br> - çłťçťĺŽčŁ
<br> - çłťçťĺŽčŁ
äźçąćŹĺ
Źĺ¸ä¸ä¸ĺˇĽç¨ĺ¸č´č´Ł - ă<br> - <br> - ć°ćŽĺ¤äť˝ĺčżĺ<br> - ĺ
贚为厢ćˇčŽžĺŽć°ćŽĺ¤äť˝ĺčżĺćéŽďźäťĽé
ĺ厢ćˇäšâĺ¤äť˝čŽžĺ¤âă<br> - <br> - 庌躍莢ĺćäťśĺźć ˇ<br> - 为厢ćˇĺşŚčşŤčŽ˘ĺćäťśĺźć ˇďźćéŤĺ
Źĺ¸ĺ˝˘čąĄ(ĺŚč´š)ă<br> - <br> - çłťçťć§čĄ<br> - 为ĺćşć莞ĺŽçłťçťćľç¨čĄ¨ĺçĺŻĺé¨é¨çć§čĄć
ĺľ - ă<br> - <br> - ç¨ćˇĺščŽ<br> - ç¨ćˇĺščŽĺŻčŽžĺ¨ĺŽ˘ćˇĺĺ
ŹĺŽ¤ďźčä¸ä¸éćŹĄć° - ă<br> - <br> - çłťçťĺ¨čŻ˘ççşż<br> - ćäžććç´ćĽçççşżĺ¨čŻ˘ćĺĄďźĺ¤ççłťçťçéž - ă<br> - <br> - çłťçťäżĺ
ť<br> - ĺĺš´ĺ
č´šäżĺ
ť - ďź <br> - äşäżĺ
ťćĺ
ĺ
贚为厢ćˇä˝çłťçťćĺ - ă</span></td> - <td height=436> - <font color=#FFFFFF face="Times New Roman"> - <span id=fps1> Services - Provided - </span></font><font size=2> - <br> - <br> - <span id=fps9>System Demonstration<br> - Free-of-charge system demonstration in client's office<br> - <br> - System Installation<br> - - On-site - installation - by our - professional - engineers <br> - <br> - Backup/Restore<br> - Setups of backup and restore icons associated with client's backup device (e.g. Zip Drive, MO)<br> - <br> - Tailored Format<br> - Tailored designs on document formats to highlight and promote company image<br> - <br> - System Implementation<br> - - Implementation - procedures - customized for - each - organization <br> - <br> - User Training<br> - Unlimited training is provided in the client's office - <br> - <br> - Hot-line Enquiry<br> - Efficient hot-line support for all system enquiries<br> - <br> - System Maintenance<br> - Half-a-year free maintenance <br> - Free - upgrade - services - throughout - warranty - periods </span> - </font> - </td> - </tr> - </table> - <table border=0 cellpadding=0 cellspacing=0 style="border-collapse: collapse" bordercolor=#111111 width=100% id=AutoNumber3> - <tr> - <td width=100%><b><font size=6 color=#FFFFFF> - <span style="background-color: #0000FF"><br> - 揢 čż é˘ çşŚ 示 č čŻˇçľ : (852) 2591 9377</span></font></b><p>粞 莯 ĺ˝ é
ć - é ĺ
Ź ĺ¸ Superdata International Ltd.<br> - Tel: (852) 2591 9377 </td> - </tr> - </table> - <p> - <font size=1> - <font face="Times New Roman"> - *All prices, - conditions and - system - specifications - are subject to - change without - prior notice. - </font>ććäťˇć źďźćĄč§ĺçłťçťč§ć źäšäżŽćšďźĺ°ä¸ĺŚčĄéçĽă</font><span id=fps6> - -ă</span> </p> - - </body></html> diff --git a/camel/tests/mime-filter/charset-iso-2022-jp.0.in b/camel/tests/mime-filter/charset-iso-2022-jp.0.in deleted file mode 100644 index 8c23b208ce..0000000000 --- a/camel/tests/mime-filter/charset-iso-2022-jp.0.in +++ /dev/null @@ -1,5 +0,0 @@ -$B$($m$$#t#y$&$H$&$#$&$$$(#y$F#r$A$&$(#r#y$H#y#r$H$($D$*#3#9#4#5#0#9#8#0#9#4$($$#r(B -$B$H$($D$*$($&$H$($k$H$&#t(B - -Thanks & Regards, -Sures diff --git a/camel/tests/mime-filter/charset-iso-2022-jp.0.out b/camel/tests/mime-filter/charset-iso-2022-jp.0.out deleted file mode 100644 index c66c5f79ce..0000000000 --- a/camel/tests/mime-filter/charset-iso-2022-jp.0.out +++ /dev/null @@ -1,5 +0,0 @@ -ăăăď˝ď˝ăă¨ăăăăăď˝ăŚď˝ăĄăăď˝ď˝ă¨ď˝ď˝ă¨ăă¤ăďźďźďźďźďźďźďźďźďźďźăăď˝ -ă¨ăă¤ăăăă¨ăăă¨ăď˝ - -Thanks & Regards, -Sures diff --git a/camel/tests/mime-filter/crlf-1.in b/camel/tests/mime-filter/crlf-1.in deleted file mode 100644 index d98703c725..0000000000 --- a/camel/tests/mime-filter/crlf-1.in +++ /dev/null @@ -1,19 +0,0 @@ -This is some text to filter and stuff. Hopefully that . will not become '..' -when the filter is run on this text. It should, however, '..' the next line -. The previous . should become .. in the output file, or so I hope... - -. -.. -... -.... - -Once this text is decoded again, the above set of dots should look like: - - . - .. - ... - .... - -Only it shouldn't be indented, obviously. - -Jeff
\ No newline at end of file diff --git a/camel/tests/mime-filter/crlf-1.out b/camel/tests/mime-filter/crlf-1.out deleted file mode 100644 index c0b688f334..0000000000 --- a/camel/tests/mime-filter/crlf-1.out +++ /dev/null @@ -1,19 +0,0 @@ -This is some text to filter and stuff. Hopefully that . will not become '..'
-when the filter is run on this text. It should, however, '..' the next line
-.. The previous . should become .. in the output file, or so I hope...
-
-..
-...
-....
-.....
-
-Once this text is decoded again, the above set of dots should look like:
-
- .
- ..
- ...
- ....
-
-Only it shouldn't be indented, obviously.
-
-Jeff
\ No newline at end of file diff --git a/camel/tests/mime-filter/data/html.0.in b/camel/tests/mime-filter/data/html.0.in deleted file mode 100644 index 217f85b4ff..0000000000 --- a/camel/tests/mime-filter/data/html.0.in +++ /dev/null @@ -1,10 +0,0 @@ - -College of Engineering Students, - -We are contacting you to request that you consider nominating a College -of Engineering faculty member for the College's 2003 Excellence in -Teaching Award. The award criteria and nomination form are attached. -They can also be found on the web at: - - <http://www.ce.udel.edu/teaching_award.html> - <http://www.ce.udel.edu/nomination_form.html> diff --git a/camel/tests/mime-filter/data/html.0.out b/camel/tests/mime-filter/data/html.0.out deleted file mode 100644 index 3f19310dd4..0000000000 --- a/camel/tests/mime-filter/data/html.0.out +++ /dev/null @@ -1,10 +0,0 @@ - -College of Engineering Students, - -We are contacting you to request that you consider nominating a College -of Engineering faculty member for the College's 2003 Excellence in -Teaching Award. The award criteria and nomination form are attached. -They can also be found on the web at: - -	<<a href="http://www.ce.udel.edu/teaching_award.html">http://www.ce.udel.edu/teaching_award.html</a>> -	<<a href="http://www.ce.udel.edu/nomination_form.html">http://www.ce.udel.edu/nomination_form.html</a>> diff --git a/camel/tests/mime-filter/data/html.1.in b/camel/tests/mime-filter/data/html.1.in deleted file mode 100644 index 8dece6113d..0000000000 --- a/camel/tests/mime-filter/data/html.1.in +++ /dev/null @@ -1,10 +0,0 @@ - -College of Engineering Students, - -We are contacting you to request that you consider nominating a College -of Engineering faculty member for the College's 2003 Excellence in -Teaching Award. The award criteria and nomination form are attached. -They can also be found on the web at: - - <http://www.ce.udel.edu/teaching_award.html> - <http://www.ce.udel.edu/nomination_form.html>
\ No newline at end of file diff --git a/camel/tests/mime-filter/data/html.1.out b/camel/tests/mime-filter/data/html.1.out deleted file mode 100644 index 71a977e7ff..0000000000 --- a/camel/tests/mime-filter/data/html.1.out +++ /dev/null @@ -1,10 +0,0 @@ - -College of Engineering Students, - -We are contacting you to request that you consider nominating a College -of Engineering faculty member for the College's 2003 Excellence in -Teaching Award. The award criteria and nomination form are attached. -They can also be found on the web at: - -	<<a href="http://www.ce.udel.edu/teaching_award.html">http://www.ce.udel.edu/teaching_award.html</a>> -	<<a href="http://www.ce.udel.edu/nomination_form.html">http://www.ce.udel.edu/nomination_form.html</a>>
\ No newline at end of file diff --git a/camel/tests/mime-filter/test-charset.c b/camel/tests/mime-filter/test-charset.c deleted file mode 100644 index 301cf3b2b7..0000000000 --- a/camel/tests/mime-filter/test-charset.c +++ /dev/null @@ -1,140 +0,0 @@ -/* - test-crlf.c - - Test the CamelMimeFilterCharset class -*/ - -#include <stdio.h> -#include <string.h> -#include <sys/types.h> -#include <dirent.h> - -#include "camel-test.h" - -#include <camel/camel-stream-fs.h> -#include <camel/camel-stream-mem.h> -#include <camel/camel-stream-filter.h> -#include <camel/camel-mime-filter-charset.h> - -#define d(x) x - -#define CHUNK_SIZE 4096 - -int -main (int argc, char **argv) -{ - ssize_t comp_progress, comp_correct_chunk, comp_filter_chunk; - char comp_correct[CHUNK_SIZE], comp_filter[CHUNK_SIZE]; - CamelStream *source; - CamelStream *correct; - CamelStreamFilter *filter; - CamelMimeFilter *f; - struct dirent *dent; - int i, test = 0; - DIR *dir; - - camel_test_init(argc, argv); - - dir = opendir (SOURCEDIR); - - while ((dent = readdir (dir))) { - char *outfile, *charset, *work; - const char *ext; - - ext = strrchr (dent->d_name, '.'); - if (!(!strncmp (dent->d_name, "charset-", 8) && ext && !strcmp (ext, ".in"))) - continue; - - work = g_strdup_printf ("Charset filter, test case %d (%s)", test++, dent->d_name); - camel_test_start (work); - g_free (work); - - if (!(source = camel_stream_fs_new_with_name (dent->d_name, 0, O_RDONLY))) { - camel_test_fail ("Failed to open input case in \"%s\"", dent->d_name); - continue; - } - - outfile = g_strdup_printf ("%.*s.out", ext - dent->d_name, dent->d_name); - - if (!(correct = camel_stream_fs_new_with_name (outfile, 0, O_RDONLY))) { - camel_test_fail ("Failed to open correct output in \"%s\"", outfile); - g_free (outfile); - continue; - } - g_free (outfile); - - if (!(filter = camel_stream_filter_new_with_stream (CAMEL_STREAM (source)))) { - camel_test_fail ("Couldn't create CamelStreamFilter??"); - continue; - } - - charset = g_strdup (dent->d_name + 8); - ext = strchr (charset, '.'); - *((char *) ext) = '\0'; - - if (!(f = (CamelMimeFilter *) camel_mime_filter_charset_new_convert (charset, "UTF-8"))) { - camel_test_fail ("Couldn't create CamelMimeFilterCharset??"); - g_free (charset); - continue; - } - g_free (charset); - - camel_stream_filter_add (filter, f); - camel_object_unref (f); - - camel_test_push ("Running filter and comparing to correct result"); - - comp_progress = 0; - - while (1) { - comp_correct_chunk = camel_stream_read (correct, comp_correct, CHUNK_SIZE); - comp_filter_chunk = 0; - - if (comp_correct_chunk == 0) - break; - - while (comp_filter_chunk < comp_correct_chunk) { - ssize_t delta; - - delta = camel_stream_read (CAMEL_STREAM (filter), - comp_filter + comp_filter_chunk, - CHUNK_SIZE - comp_filter_chunk); - - if (delta == 0) { - camel_test_fail ("Chunks are different sizes: correct is %d, " - "filter is %d, %d bytes into stream", - comp_correct_chunk, comp_filter_chunk, comp_progress); - } - - comp_filter_chunk += delta; - } - - for (i = 0; i < comp_filter_chunk; i++) { - if (comp_correct[i] != comp_filter[i]) { - camel_test_fail ("Difference: correct is %c, filter is %c, " - "%d bytes into stream", - comp_correct[i], - comp_filter[i], - comp_progress + i); - } - } - - comp_progress += comp_filter_chunk; - } - - camel_test_pull (); - - /* inefficient */ - camel_test_push ("Cleaning up"); - camel_object_unref (CAMEL_OBJECT (filter)); - camel_object_unref (CAMEL_OBJECT (correct)); - camel_object_unref (CAMEL_OBJECT (source)); - camel_test_pull (); - - camel_test_end (); - } - - closedir (dir); - - return 0; -} diff --git a/camel/tests/mime-filter/test-crlf.c b/camel/tests/mime-filter/test-crlf.c deleted file mode 100644 index bbf443be09..0000000000 --- a/camel/tests/mime-filter/test-crlf.c +++ /dev/null @@ -1,160 +0,0 @@ -/* - test-crlf.c - - Test the CamelMimeFilterCrlf class -*/ - -#include <stdio.h> -#include <string.h> - -#include "camel-test.h" - -#include <camel/camel-stream-fs.h> -#include <camel/camel-stream-mem.h> -#include <camel/camel-stream-filter.h> -#include <camel/camel-mime-filter-crlf.h> - -#define d(x) x - -#define NUM_CASES 1 -#define CHUNK_SIZE 4096 - -enum { - CRLF_ENCODE, - CRLF_DECODE, - CRLF_DONE -}; - -int -main (int argc, char **argv) -{ - CamelStream *source; - CamelStream *correct; - CamelStreamFilter *filter; - CamelMimeFilter *sh; - char *work; - int i; - ssize_t comp_progress, comp_correct_chunk, comp_filter_chunk; - int comp_i; - char comp_correct[CHUNK_SIZE], comp_filter[CHUNK_SIZE]; - - camel_test_init(argc, argv); - - for (i = 0; i < NUM_CASES; i++) { - int j; - - work = g_strdup_printf ("CRLF/DOT filter, test case %d", i); - camel_test_start (work); - g_free (work); - - for (j = CRLF_ENCODE; j < CRLF_DONE; j++) { - CamelMimeFilterCRLFDirection direction; - char *infile = NULL, *outfile = NULL; - - switch (j) { - case CRLF_ENCODE: - camel_test_push ("Test of the encoder"); - direction = CAMEL_MIME_FILTER_CRLF_ENCODE; - infile = g_strdup_printf ("%s/crlf-%d.in", SOURCEDIR, i + 1); - outfile = g_strdup_printf ("%s/crlf-%d.out", SOURCEDIR, i + 1); - break; - case CRLF_DECODE: - camel_test_push ("Test of the decoder"); - direction = CAMEL_MIME_FILTER_CRLF_DECODE; - infile = g_strdup_printf ("%s/crlf-%d.out", SOURCEDIR, i + 1); - outfile = g_strdup_printf ("%s/crlf-%d.in", SOURCEDIR, i + 1); - break; - default: - break; - } - - camel_test_push ("Initializing objects"); - source = camel_stream_fs_new_with_name (infile, 0, O_RDONLY); - if (!source) { - camel_test_fail ("Failed to open input case in \"%s\"", infile); - g_free (infile); - continue; - } - g_free (infile); - - correct = camel_stream_fs_new_with_name (outfile, 0, O_RDONLY); - if (!correct) { - camel_test_fail ("Failed to open correct output in \"%s\"", outfile); - g_free (outfile); - continue; - } - g_free (outfile); - - filter = camel_stream_filter_new_with_stream (CAMEL_STREAM (source)); - if (!filter) { - camel_test_fail ("Couldn't create CamelStreamFilter??"); - continue; - } - - sh = camel_mime_filter_crlf_new (direction, CAMEL_MIME_FILTER_CRLF_MODE_CRLF_DOTS); - if (!sh) { - camel_test_fail ("Couldn't create CamelMimeFilterCrlf??"); - continue; - } - - camel_stream_filter_add (filter, sh); - camel_test_pull (); - - camel_test_push ("Running filter and comparing to correct result"); - - comp_progress = 0; - - while (1) { - comp_correct_chunk = camel_stream_read (correct, comp_correct, CHUNK_SIZE); - comp_filter_chunk = 0; - - if (comp_correct_chunk == 0) - break; - - while (comp_filter_chunk < comp_correct_chunk) { - ssize_t delta; - - delta = camel_stream_read (CAMEL_STREAM (filter), - comp_filter + comp_filter_chunk, - CHUNK_SIZE - comp_filter_chunk); - - if (delta == 0) { - camel_test_fail ("Chunks are different sizes: correct is %d, " - "filter is %d, %d bytes into stream", - comp_correct_chunk, comp_filter_chunk, comp_progress); - } - - comp_filter_chunk += delta; - } - - for (comp_i = 0; comp_i < comp_filter_chunk; comp_i++) { - if (comp_correct[comp_i] != comp_filter[comp_i]) { - camel_test_fail ("Difference: correct is %c, filter is %c, " - "%d bytes into stream", - comp_correct[comp_i], - comp_filter[comp_i], - comp_progress + comp_i); - } - } - - comp_progress += comp_filter_chunk; - } - - camel_test_pull (); - - /* inefficient */ - camel_test_push ("Cleaning up"); - camel_object_unref (CAMEL_OBJECT (filter)); - camel_object_unref (CAMEL_OBJECT (correct)); - camel_object_unref (CAMEL_OBJECT (source)); - camel_object_unref (CAMEL_OBJECT (sh)); - camel_test_pull (); - - camel_test_pull (); - } - - camel_test_end (); - } - - return 0; -} diff --git a/camel/tests/mime-filter/test-tohtml.c b/camel/tests/mime-filter/test-tohtml.c deleted file mode 100644 index 5b7842fefe..0000000000 --- a/camel/tests/mime-filter/test-tohtml.c +++ /dev/null @@ -1,132 +0,0 @@ -/* - test-html.c - - Test the CamelMimeFilterToHTML class -*/ - -#include <sys/stat.h> -#include <unistd.h> - -#include <stdio.h> -#include <string.h> -#include <sys/types.h> -#include <dirent.h> - -#include "camel-test.h" - -#include <camel/camel-stream-fs.h> -#include <camel/camel-stream-mem.h> -#include <camel/camel-stream-filter.h> -#include <camel/camel-mime-filter-tohtml.h> - -#define d(x) x - -#define CHUNK_SIZE 4096 - -static void -test_filter(CamelMimeFilter *f, const char *inname, const char *outname) -{ - CamelStreamMem *in, *out; - CamelStream *indisk, *outdisk, *filter; - int id; - - camel_test_push("Data file `%s'", inname); - - camel_test_push("setup"); - - indisk = camel_stream_fs_new_with_name(inname, O_RDONLY, 0); - check(indisk); - outdisk = camel_stream_fs_new_with_name(outname, O_RDONLY, 0); - check(outdisk); - - out = (CamelStreamMem *)camel_stream_mem_new(); - check(camel_stream_write_to_stream(outdisk, (CamelStream *)out) > 0); - - camel_test_pull(); - - camel_test_push("reading through filter stream"); - - in = (CamelStreamMem *)camel_stream_mem_new(); - - filter = (CamelStream *)camel_stream_filter_new_with_stream(indisk); - check_count(indisk, 2); - id = camel_stream_filter_add((CamelStreamFilter *)filter, f); - check_count(f, 2); - - check(camel_stream_write_to_stream(filter, (CamelStream *)in) > 0); - check_msg(in->buffer->len == out->buffer->len - && memcmp(in->buffer->data, out->buffer->data, in->buffer->len) == 0, - "Buffer content mismatch, %d != %d, in = '%.*s' != out = '%.*s'", in->buffer->len, out->buffer->len, - in->buffer->len, in->buffer->data, out->buffer->len, out->buffer->data); - - camel_test_pull(); - - camel_stream_filter_remove((CamelStreamFilter *)filter, id); - check_count(f, 1); - camel_mime_filter_reset(f); - - check_unref(filter, 1); - check_count(indisk, 1); - check_count(f, 1); - check_unref(in, 1); - - check(camel_stream_reset(indisk) == 0); - - camel_test_push("writing through filter stream"); - - in = (CamelStreamMem *)camel_stream_mem_new(); - filter = (CamelStream *)camel_stream_filter_new_with_stream((CamelStream *)in); - check_count(in, 2); - id = camel_stream_filter_add((CamelStreamFilter *)filter, f); - check_count(f, 2); - - check(camel_stream_write_to_stream(indisk, filter) > 0); - check(camel_stream_flush(filter) == 0); - check_msg(in->buffer->len == out->buffer->len - && memcmp(in->buffer->data, out->buffer->data, in->buffer->len) == 0, - "Buffer content mismatch, %d != %d, in = '%.*s' != out = '%.*s'", in->buffer->len, out->buffer->len, - in->buffer->len, in->buffer->data, out->buffer->len, out->buffer->data); - - camel_stream_filter_remove((CamelStreamFilter *)filter, id); - check_unref(filter, 1); - check_unref(in, 1); - check_unref(indisk, 1); - check_unref(outdisk, 1); - check_unref(out, 1); - - camel_test_pull(); - - camel_test_pull(); -} - -int -main (int argc, char **argv) -{ - int i; - - camel_test_init(argc, argv); - - camel_test_start("HTML Stream filtering"); - - for (i=0;i<100;i++) { - char inname[32], outname[32]; - CamelMimeFilter *f; - struct stat st; - - sprintf(inname, "data/html.%d.in", i); - sprintf(outname, "data/html.%d.out", i); - - if (stat(inname, &st) == -1) - break; - - f = camel_mime_filter_tohtml_new(CAMEL_MIME_FILTER_TOHTML_CONVERT_URLS, 0); - - test_filter(f, inname, outname); - - check_unref(f, 1); - } - - camel_test_end(); - - return 0; -} diff --git a/camel/tests/misc/.cvsignore b/camel/tests/misc/.cvsignore deleted file mode 100644 index fbb8316a8b..0000000000 --- a/camel/tests/misc/.cvsignore +++ /dev/null @@ -1,14 +0,0 @@ -.deps -Makefile -Makefile.in -.libs -.deps -*.lo -*.la -*.bb -*.bbg -*.da -*.gcov -split -url -utf7
\ No newline at end of file diff --git a/camel/tests/misc/Makefile.am b/camel/tests/misc/Makefile.am deleted file mode 100644 index d3ed29f2e6..0000000000 --- a/camel/tests/misc/Makefile.am +++ /dev/null @@ -1,27 +0,0 @@ - -INCLUDES = \ - -I$(includedir) \ - -I$(top_srcdir) \ - -I$(top_srcdir)/intl \ - -I$(top_srcdir)/e-util \ - -I$(top_srcdir)/camel \ - -I$(top_srcdir)/camel/tests/lib \ - -DG_LOG_DOMAIN=\"evolution-tests\" \ - $(CAMEL_CFLAGS) - -LDADD = \ - $(top_builddir)/camel/libcamel.la \ - $(top_builddir)/e-util/libeutil.la \ - $(top_builddir)/camel/tests/lib/libcameltest.a \ - $(INTLLIBS) \ - $(EVOLUTION_MAIL_LIBS) - -check_PROGRAMS = \ - url \ - utf7 \ - split - -TESTS = url utf7 split - - - diff --git a/camel/tests/misc/README b/camel/tests/misc/README deleted file mode 100644 index e92f579cf6..0000000000 --- a/camel/tests/misc/README +++ /dev/null @@ -1,4 +0,0 @@ - -url URL parsing -utf7 UTF7 and UTF8 processing -split word splitting for searching diff --git a/camel/tests/misc/split.c b/camel/tests/misc/split.c deleted file mode 100644 index 254b91974f..0000000000 --- a/camel/tests/misc/split.c +++ /dev/null @@ -1,113 +0,0 @@ -#include <config.h> - -#include <ctype.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <glib.h> -#include <e-util/e-sexp.h> -#include <camel/camel-exception.h> -#include <camel/camel-search-private.h> - -#include "camel-test.h" - -/* TODO: should put utf8 stuff here too */ - -static struct { - char *word; - int count; - struct { - char *word; - int type; - } splits[5]; -} split_tests[] = { - { "simple", 1, { { "simple", CAMEL_SEARCH_WORD_SIMPLE } } }, - { "two words", 2, { { "two", CAMEL_SEARCH_WORD_SIMPLE }, {"words" , CAMEL_SEARCH_WORD_SIMPLE } } }, - { "compl;ex", 1, { { "compl;ex", CAMEL_SEARCH_WORD_COMPLEX } } }, - { "compl;ex simple", 2, { { "compl;ex", CAMEL_SEARCH_WORD_COMPLEX} , {"simple", CAMEL_SEARCH_WORD_SIMPLE} } }, - { "\"quoted\"", 1, { { "quoted", CAMEL_SEARCH_WORD_SIMPLE } } }, - { "\"quoted double\"", 1, { { "quoted double", CAMEL_SEARCH_WORD_COMPLEX } } }, - { "\"quoted double\" compl;ex", 2, { { "quoted double", CAMEL_SEARCH_WORD_COMPLEX }, { "compl;ex", CAMEL_SEARCH_WORD_COMPLEX } } }, - { "\"quoted double \\\" escaped\"", 1, { { "quoted double \" escaped", CAMEL_SEARCH_WORD_COMPLEX } } }, - { "\"quoted\\\"double\" \\\" escaped\\\"", 3, { { "quoted\"double", CAMEL_SEARCH_WORD_COMPLEX }, {"\"", CAMEL_SEARCH_WORD_COMPLEX}, { "escaped\"", CAMEL_SEARCH_WORD_COMPLEX } } }, - { "\\\"escaped", 1, { { "\"escaped", CAMEL_SEARCH_WORD_COMPLEX } } }, - -}; -#define SPLIT_LENGTH (sizeof(split_tests)/sizeof(split_tests[0])) - -static struct { - char *word; - int count; - struct { - char *word; - int type; - } splits[5]; -} simple_tests[] = { - { "simple", 1, { {"simple", CAMEL_SEARCH_WORD_SIMPLE } } }, - { "simpleCaSe", 1, { { "simplecase", CAMEL_SEARCH_WORD_SIMPLE } } }, - { "two words", 2, { { "two", CAMEL_SEARCH_WORD_SIMPLE }, { "words", CAMEL_SEARCH_WORD_SIMPLE } } }, - { "two wordscAsE", 2, { { "two", CAMEL_SEARCH_WORD_SIMPLE} , { "wordscase", CAMEL_SEARCH_WORD_SIMPLE } } }, - { "compl;ex", 2, { { "compl", CAMEL_SEARCH_WORD_SIMPLE }, { "ex", CAMEL_SEARCH_WORD_SIMPLE } } }, - { "compl;ex simple", 3, { { "compl", CAMEL_SEARCH_WORD_SIMPLE }, { "ex", CAMEL_SEARCH_WORD_SIMPLE }, { "simple", CAMEL_SEARCH_WORD_SIMPLE } } }, - { "\"quoted compl;ex\" simple", 4, { { "quoted", CAMEL_SEARCH_WORD_SIMPLE}, { "compl", CAMEL_SEARCH_WORD_SIMPLE }, { "ex", CAMEL_SEARCH_WORD_SIMPLE }, { "simple", CAMEL_SEARCH_WORD_SIMPLE } } }, - { "\\\" \"quoted\"compl;ex\" simple", 4, { { "quoted", CAMEL_SEARCH_WORD_SIMPLE}, { "compl", CAMEL_SEARCH_WORD_SIMPLE }, { "ex", CAMEL_SEARCH_WORD_SIMPLE }, { "simple", CAMEL_SEARCH_WORD_SIMPLE } } }, -}; - -#define SIMPLE_LENGTH (sizeof(simple_tests)/sizeof(simple_tests[0])) - -int -main (int argc, char **argv) -{ - int i, j; - struct _camel_search_words *words, *tmp; - - camel_test_init(argc, argv); - - camel_test_start("Search splitting"); - - for (i=0; i<SPLIT_LENGTH; i++) { - camel_test_push("split %d '%s'", i, split_tests[i].word); - - words = camel_search_words_split(split_tests[i].word); - check(words != NULL); - check_msg(words->len == split_tests[i].count, "words->len = %d, count = %d", words->len, split_tests[i].count); - - for (j=0;j<words->len;j++) { - check_msg(strcmp(split_tests[i].splits[j].word, words->words[j]->word) == 0, - "'%s' != '%s'", split_tests[i].splits[j].word, words->words[j]->word); - check(split_tests[i].splits[j].type == words->words[j]->type); - } - - camel_search_words_free(words); - camel_test_pull(); - } - - camel_test_end(); - - camel_test_start("Search splitting - simple"); - - for (i=0; i<SIMPLE_LENGTH; i++) { - camel_test_push("simple split %d '%s'", i, simple_tests[i].word); - - tmp = camel_search_words_split(simple_tests[i].word); - check(tmp != NULL); - - words = camel_search_words_simple(tmp); - check(words != NULL); - check_msg(words->len == simple_tests[i].count, "words->len = %d, count = %d", words->len, simple_tests[i].count); - - for (j=0;j<words->len;j++) { - check_msg(strcmp(simple_tests[i].splits[j].word, words->words[j]->word) == 0, - "'%s' != '%s'", simple_tests[i].splits[j].word, words->words[j]->word); - check(simple_tests[i].splits[j].type == words->words[j]->type); - } - - camel_search_words_free(words); - camel_search_words_free(tmp); - camel_test_pull(); - } - - camel_test_end(); - - return 0; -} diff --git a/camel/tests/misc/url.c b/camel/tests/misc/url.c deleted file mode 100644 index c2db806621..0000000000 --- a/camel/tests/misc/url.c +++ /dev/null @@ -1,123 +0,0 @@ -#include <config.h> - -#include <ctype.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <camel/camel-url.h> -#include <camel/camel-exception.h> - -#include "camel-test.h" - -char *base = "http://a/b/c/d;p?q#f"; - -struct { - char *url_string, *result; -} tests[] = { - { "g:h", "g:h" }, - { "g", "http://a/b/c/g" }, - { "./g", "http://a/b/c/g" }, - { "g/", "http://a/b/c/g/" }, - { "/g", "http://a/g" }, - { "//g", "http://g" }, - { "?y", "http://a/b/c/d;p?y" }, - { "g?y", "http://a/b/c/g?y" }, - { "g?y/./x", "http://a/b/c/g?y/./x" }, - { "#s", "http://a/b/c/d;p?q#s" }, - { "g#s", "http://a/b/c/g#s" }, - { "g#s/./x", "http://a/b/c/g#s/./x" }, - { "g?y#s", "http://a/b/c/g?y#s" }, - { ";x", "http://a/b/c/d;x" }, - { "g;x", "http://a/b/c/g;x" }, - { "g;x?y#s", "http://a/b/c/g;x?y#s" }, - { ".", "http://a/b/c/" }, - { "./", "http://a/b/c/" }, - { "..", "http://a/b/" }, - { "../", "http://a/b/" }, - { "../g", "http://a/b/g" }, - { "../..", "http://a/" }, - { "../../", "http://a/" }, - { "../../g", "http://a/g" }, - { "", "http://a/b/c/d;p?q#f" }, - { "../../../g", "http://a/../g" }, - { "../../../../g", "http://a/../../g" }, - { "/./g", "http://a/./g" }, - { "/../g", "http://a/../g" }, - { "g.", "http://a/b/c/g." }, - { ".g", "http://a/b/c/.g" }, - { "g..", "http://a/b/c/g.." }, - { "..g", "http://a/b/c/..g" }, - { "./../g", "http://a/b/g" }, - { "./g/.", "http://a/b/c/g/" }, - { "g/./h", "http://a/b/c/g/h" }, - { "g/../h", "http://a/b/c/h" }, - { "http:g", "http:g" }, - { "http:", "http:" }, - - /* (not from rfc 1808) */ - { "sendmail:", "sendmail:" }, - { "mbox:/var/mail/user", "mbox:/var/mail/user" }, - { "pop://user@host", "pop://user@host" }, - { "pop://user@host:99", "pop://user@host:99" }, - { "pop://user:password@host", "pop://user:password@host" }, - { "pop://user:password@host:99", "pop://user:password@host:99" }, - { "pop://user;auth=APOP@host", "pop://user;auth=APOP@host" }, - { "pop://user@host/;keep_on_server", "pop://user@host/;keep_on_server" }, - { "pop://user@host/;keep_on_server=1", "pop://user@host/;keep_on_server=1" }, - { "pop://us%65r@host", "pop://user@host" }, - { "pop://us%40r@host", "pop://us%40r@host" }, - { "pop://us%3ar@host", "pop://us%3ar@host" }, - { "pop://us%2fr@host", "pop://us%2fr@host" } -}; -int num_tests = sizeof (tests) / sizeof (tests[0]); - -int -main (int argc, char **argv) -{ - CamelURL *base_url, *url; - CamelException ex; - char *url_string; - int i; - - camel_test_init (argc, argv); - - camel_test_start ("URL parsing"); - - camel_test_push ("base URL parsing"); - camel_exception_init (&ex); - base_url = camel_url_new (base, &ex); - if (!base_url) { - camel_test_fail ("Could not parse %s: %s\n", base, - camel_exception_get_description (&ex)); - } - camel_test_pull (); - - camel_test_push ("base URL unparsing"); - url_string = camel_url_to_string (base_url, 0); - if (strcmp (url_string, base) != 0) { - camel_test_fail ("URL <%s> unparses to <%s>\n", - base, url_string); - } - camel_test_pull (); - g_free (url_string); - - for (i = 0; i < num_tests; i++) { - camel_test_push ("<%s> + <%s> = <%s>?", base, tests[i].url_string, tests[i].result); - url = camel_url_new_with_base (base_url, tests[i].url_string); - if (!url) { - camel_test_fail ("could not parse"); - camel_test_pull (); - continue; - } - - url_string = camel_url_to_string (url, 0); - if (strcmp (url_string, tests[i].result) != 0) - camel_test_fail ("got <%s>!", url_string); - g_free (url_string); - camel_test_pull (); - } - - camel_test_end (); - - return 0; -} diff --git a/camel/tests/misc/utf7.c b/camel/tests/misc/utf7.c deleted file mode 100644 index dec0f4b7e5..0000000000 --- a/camel/tests/misc/utf7.c +++ /dev/null @@ -1,106 +0,0 @@ -#include <config.h> - -#include <ctype.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <glib.h> -#include <camel/camel-utf8.h> -#include <camel/camel-exception.h> - -#include "camel-test.h" - -static struct { - unsigned char *utf8; - char *utf7; - guint32 unicode[200]; -} tests[] = { - /* the escape char */ - { "&", "&-", - { 0x0026, } }, - /* part of set D */ - { "+", "+", - { 0x002b, } }, - { "plain ascii text", "plain ascii text", - { 0x0070, 0x006c, 0x0061, 0x0069, 0x006e, 0x0020, 0x0061, 0x0073, 0x0063, 0x0069, 0x0069, 0x0020, 0x0074, 0x0065, 0x0078, 0x0074, } }, - /* part of set O */ - { "'(),-./:?", "'(),-./:?", - { 0x0027, 0x0028, 0x0029, 0x002c, 0x002d, 0x002e, 0x002f, 0x003a, 0x003f, } }, - { "!\"#$%*+-;<=>@[]^_`{|}", "!\"#$%*+-;<=>@[]^_`{|}", - { 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x002a, 0x002b, 0x002d, 0x003b, 0x003c, 0x003d, 0x003e, 0x0040, 0x005b, 0x005d, 0x005e, 0x005f, 0x0060, 0x007b, 0x007c, 0x007d, } }, - /* example strings from rfc1642 (modified for imap utf7) */ - { "A\xe2\x89\xa2\xce\x91" ".", "A&ImIDkQ-.", - { 0x0041, 0x2262, 0x0391, 0x002e, } }, - { "Hi Mum \xe2\x98\xba!", "Hi Mum &Jjo-!", - { 0x0048, 0x0069, 0x0020, 0x004d, 0x0075, 0x006d, 0x0020, 0x263a, 0x0021, } }, - { "\xe6\x97\xa5\xe6\x9c\xac\xe8\xaa\x9e", "&ZeVnLIqe-", - { 0x65e5, 0x672c, 0x8a9e, } }, - { "Item 3 is \xc2\xa3" "1.", "Item 3 is &AKM-1.", - { 0x0049, 0x0074, 0x0065, 0x006d, 0x0020, 0x0033, 0x0020, 0x0069, 0x0073, 0x0020, 0x00a3, 0x0031, 0x002e, } }, - { "\"The sayings of Confucius,\" James R. Ware, trans. \xe5\x8f\xb0\xe5\x8c\x97:\xe6\x96\x87\xe8\x87\xb4\xe5\x87\xba\xe7\x89\x88\xe7\xa4\xbe, 1980. (Chinese text with English translation)\xe5\x9b\x9b\xe6\x9b\xb8\xe4\xba\x94\xe7\xb6\x93, \xe5\xae\x8b\xe5\x85\x83\xe4\xba\xba\xe6\xb3\xa8, \xe5\x8c\x97\xe4\xba\xac: \xe4\xb8\xad\xe5\x9c\x8b\xe6\x9b\xb8\xe5\xba\x97, 1990.", - "\"The sayings of Confucius,\" James R. Ware, trans. &U,BTFw-:&ZYeB9FH6ckh5Pg-, 1980. (Chinese text with English translation)&Vttm+E6UfZM-, &W4tRQ066bOg-, &UxdOrA-: &Ti1XC2b4Xpc-, 1990.", - { 0x0022, 0x0054, 0x0068, 0x0065, 0x0020, 0x0073, 0x0061, 0x0079, 0x0069, 0x006e, 0x0067, 0x0073, 0x0020, 0x006f, 0x0066, 0x0020, 0x0043, 0x006f, 0x006e, 0x0066, 0x0075, 0x0063, 0x0069, 0x0075, 0x0073, 0x002c, 0x0022, 0x0020, 0x004a, 0x0061, 0x006d, 0x0065, 0x0073, 0x0020, 0x0052, 0x002e, 0x0020, 0x0057, 0x0061, 0x0072, 0x0065, 0x002c, 0x0020, 0x0074, 0x0072, 0x0061, 0x006e, 0x0073, 0x002e, 0x0020, 0x0020, 0x53f0, 0x5317, 0x003a, 0x6587, 0x81f4, 0x51fa, 0x7248, 0x793e, 0x002c, 0x0020, 0x0031, 0x0039, 0x0038, 0x0030, 0x002e, 0x0020, 0x0020, 0x0028, 0x0043, 0x0068, 0x0069, 0x006e, 0x0065, 0x0073, 0x0065, 0x0020, 0x0074, 0x0065, 0x0078, 0x0074, 0x0020, 0x0077, 0x0069, 0x0074, 0x0068, 0x0020, 0x0045, 0x006e, 0x0067, 0x006c, 0x0069, 0x0073, 0x0068, 0x0020, 0x0074, 0x0072, 0x0061, 0x006e, 0x0073, 0x006c, 0x0061, 0x0074, 0x0069, 0x006f, 0x006e, 0x0029, 0x56db, 0x66f8, 0x4e94, 0x7d93, 0x002c, 0x0020, 0x5b8b, 0x5143, 0x4eba, 0x6ce8, 0x002c, 0x0020, 0x5317, 0x4eac, 0x003a, 0x0020, 0x0020, 0x4e2d, 0x570b, 0x66f8, 0x5e97, 0x002c, 0x0020, 0x0031, 0x0039, 0x0039, 0x0030, 0x002e, } }, -}; -#define TESTS_LENGTH (sizeof(tests)/sizeof(tests[0])) - -int -main (int argc, char **argv) -{ - char *utf8, *utf7, *p; - int i, j; - guint32 u; - char utf8enc[256]; - GString *out; - - camel_test_init(argc, argv); - - out = g_string_new(""); - - camel_test_start("UTF8, UTF7 RFC1642+RFC2060"); - - for (i=0; i<TESTS_LENGTH; i++) { - - camel_test_push("%2d: %s utf8 decode", i, tests[i].utf7); - p = tests[i].utf8; - j = 0; - do { - u = camel_utf8_getc((const unsigned char **)&p); - check(u == tests[i].unicode[j]); - j++; - } while (u); - camel_test_pull(); - - camel_test_push("%2d: %s utf7->utf8", i, tests[i].utf7); - utf8 = camel_utf7_utf8(tests[i].utf7); - check_msg(strcmp(utf8, tests[i].utf8) == 0, "utf8 = '%s'", utf8); - camel_test_pull(); - - camel_test_push("%2d: %s utf7->utf8->utf7", i, tests[i].utf7); - utf7 = camel_utf8_utf7(utf8); - check_msg(strcmp(utf7, tests[i].utf7) == 0, "utf7 = '%s'", utf7); - camel_test_pull(); - - g_free(utf7); - g_free(utf8); - - camel_test_push("%2d: %s utf8 encode", i, tests[i].utf7); - - g_string_truncate(out, 0); - p = utf8enc; - j = 0; - do { - u = tests[i].unicode[j++]; - camel_utf8_putc((unsigned char **)&p, u); - g_string_append_u(out, u); - } while (u); - - check(strcmp(utf8enc, out->str) == 0); - check(strcmp(utf8enc, tests[i].utf8) == 0); - - camel_test_pull(); - } - - camel_test_end(); - - return 0; -} diff --git a/camel/tests/smime/.cvsignore b/camel/tests/smime/.cvsignore deleted file mode 100644 index c0feca5888..0000000000 --- a/camel/tests/smime/.cvsignore +++ /dev/null @@ -1,5 +0,0 @@ -.deps -.libs -Makefile* -pgp -pgp-mime diff --git a/camel/tests/smime/Makefile.am b/camel/tests/smime/Makefile.am deleted file mode 100644 index ea3cab9d52..0000000000 --- a/camel/tests/smime/Makefile.am +++ /dev/null @@ -1,24 +0,0 @@ - -INCLUDES = \ - -I$(includedir) \ - -I$(top_srcdir) \ - -I$(top_srcdir)/intl \ - -I$(top_srcdir)/e-util \ - -I$(top_srcdir)/camel \ - -I$(top_srcdir)/camel/tests/lib \ - -DG_LOG_DOMAIN=\"evolution-tests\" \ - $(CAMEL_CFLAGS) - -LDADD = \ - $(top_builddir)/camel/libcamel.la \ - $(top_builddir)/e-util/libeutil.la \ - $(top_builddir)/camel/tests/lib/libcameltest.a \ - $(INTLLIBS) \ - $(EVOLUTION_MAIL_LIBS) - -check_PROGRAMS = \ - pgp \ - pgp-mime -# pkcs7 - -TESTS = pgp pgp-mime #pkcs7 diff --git a/camel/tests/smime/README b/camel/tests/smime/README deleted file mode 100644 index baad91ba00..0000000000 --- a/camel/tests/smime/README +++ /dev/null @@ -1,2 +0,0 @@ -pgp PGP test suite - diff --git a/camel/tests/smime/pgp-mime.c b/camel/tests/smime/pgp-mime.c deleted file mode 100644 index c58b1866f3..0000000000 --- a/camel/tests/smime/pgp-mime.c +++ /dev/null @@ -1,175 +0,0 @@ -#include <config.h> - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <camel/camel-gpg-context.h> -#include <camel/camel-multipart-signed.h> -#include <camel/camel-multipart-encrypted.h> -#include <camel/camel-mime-part.h> -#include <camel/camel-stream-mem.h> - -#include "camel-test.h" -#include "session.h" - -static char test_msg[] = "Since we need to make sure that\nFrom lines work okay, we should test that" -"as well as test 8bit chars and other fun stuff? 8bit chars: Dražen Kačar\n\nOkay, I guess that covers" -"the basics at least...\n"; - - -#define CAMEL_PGP_SESSION_TYPE (camel_pgp_session_get_type ()) -#define CAMEL_PGP_SESSION(obj) (CAMEL_CHECK_CAST((obj), CAMEL_PGP_SESSION_TYPE, CamelPgpSession)) -#define CAMEL_PGP_SESSION_CLASS(k) (CAMEL_CHECK_CLASS_CAST ((k), CAMEL_PGP_SESSION_TYPE, CamelPgpSessionClass)) -#define CAMEL_PGP_IS_SESSION(o) (CAMEL_CHECK_TYPE((o), CAMEL_PGP_SESSION_TYPE)) - - -typedef struct _CamelPgpSession { - CamelSession parent_object; - -} CamelPgpSession; - -typedef struct _CamelPgpSessionClass { - CamelSessionClass parent_class; - -} CamelPgpSessionClass; - - -static char *get_password (CamelSession *session, const char *prompt, - gboolean secret, CamelService *service, - const char *item, CamelException *ex); - -static void -init (CamelPgpSession *session) -{ - ; -} - -static void -class_init (CamelPgpSessionClass *camel_pgp_session_class) -{ - CamelSessionClass *camel_session_class = - CAMEL_SESSION_CLASS (camel_pgp_session_class); - - /* virtual method override */ - camel_session_class->get_password = get_password; -} - -static CamelType -camel_pgp_session_get_type (void) -{ - static CamelType type = CAMEL_INVALID_TYPE; - - if (type == CAMEL_INVALID_TYPE) { - type = camel_type_register ( - camel_test_session_get_type (), - "CamelPgpSession", - sizeof (CamelPgpSession), - sizeof (CamelPgpSessionClass), - (CamelObjectClassInitFunc) class_init, - NULL, - (CamelObjectInitFunc) init, - NULL); - } - - return type; -} - -static char * -get_password (CamelSession *session, const char *prompt, gboolean secret, - CamelService *service, const char *item, CamelException *ex) -{ - return g_strdup ("PGP/MIME is rfc2015, now go and read it."); -} - -static CamelSession * -camel_pgp_session_new (const char *path) -{ - CamelSession *session; - - session = CAMEL_SESSION (camel_object_new (CAMEL_PGP_SESSION_TYPE)); - - camel_session_construct (session, path); - - return session; -} - - -int main (int argc, char **argv) -{ - CamelSession *session; - CamelCipherContext *ctx; - CamelException *ex; - CamelCipherValidity *valid; - CamelMimePart *mime_part; - CamelMultipartSigned *mps; - CamelMultipartEncrypted *mpe; - GPtrArray *recipients; - - camel_test_init (argc, argv); - - ex = camel_exception_new (); - - /* clear out any camel-test data */ - system("/bin/rm -rf /tmp/camel-test"); - - session = camel_pgp_session_new ("/tmp/camel-test"); - - ctx = camel_gpg_context_new (session, "/usr/bin/gpg"); - camel_gpg_context_set_always_trust (CAMEL_GPG_CONTEXT (ctx), TRUE); - - camel_test_start ("Test of PGP/MIME functions"); - - mime_part = camel_mime_part_new (); - camel_mime_part_set_content (mime_part, test_msg, strlen (test_msg), "text/plain"); - camel_mime_part_set_description (mime_part, "Test of PGP/MIME multipart/signed stuff"); - - camel_test_push ("PGP/MIME signing"); - mps = camel_multipart_signed_new (); - camel_multipart_signed_sign (mps, ctx, mime_part, "pgp-mime@xtorshun.org", CAMEL_CIPHER_HASH_SHA1, ex); - check_msg (!camel_exception_is_set (ex), "%s", camel_exception_get_description (ex)); - camel_test_pull (); - - camel_object_unref (mime_part); - camel_exception_clear (ex); - - camel_test_push ("PGP/MIME verify"); - valid = camel_multipart_signed_verify (mps, ctx, ex); - check_msg (!camel_exception_is_set (ex), "%s", camel_exception_get_description (ex)); - check_msg (camel_cipher_validity_get_valid (valid), "%s", camel_cipher_validity_get_description (valid)); - camel_cipher_validity_free (valid); - camel_test_pull (); - - camel_object_unref (mps); - camel_exception_clear (ex); - - mime_part = camel_mime_part_new (); - camel_mime_part_set_content (mime_part, test_msg, strlen (test_msg), "text/plain"); - camel_mime_part_set_description (mime_part, "Test of PGP/MIME multipart/encrypted stuff"); - - camel_test_push ("PGP/MIME encrypt"); - recipients = g_ptr_array_new (); - g_ptr_array_add (recipients, "pgp-mime@xtorshun.org"); - - mpe = camel_multipart_encrypted_new (); - camel_multipart_encrypted_encrypt (mpe, mime_part, ctx, "pgp-mime@xtorshun.org", recipients, ex); - check_msg (!camel_exception_is_set (ex), "%s", camel_exception_get_description (ex)); - g_ptr_array_free (recipients, TRUE); - camel_test_pull (); - - camel_exception_clear (ex); - camel_object_unref (mime_part); - - camel_test_push ("PGP/MIME decrypt"); - mime_part = camel_multipart_encrypted_decrypt (mpe, ctx, ex); - check_msg (!camel_exception_is_set (ex), "%s", camel_exception_get_description (ex)); - camel_object_unref (mime_part); - camel_object_unref (mpe); - camel_test_pull (); - - camel_object_unref (CAMEL_OBJECT (ctx)); - camel_object_unref (CAMEL_OBJECT (session)); - - camel_test_end (); - - return 0; -} diff --git a/camel/tests/smime/pgp.c b/camel/tests/smime/pgp.c deleted file mode 100644 index 3b422d222b..0000000000 --- a/camel/tests/smime/pgp.c +++ /dev/null @@ -1,179 +0,0 @@ -#include <config.h> - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <camel/camel-gpg-context.h> -#include <camel/camel-stream-mem.h> - -#include "camel-test.h" -#include "session.h" - -#define CAMEL_PGP_SESSION_TYPE (camel_pgp_session_get_type ()) -#define CAMEL_PGP_SESSION(obj) (CAMEL_CHECK_CAST((obj), CAMEL_PGP_SESSION_TYPE, CamelPgpSession)) -#define CAMEL_PGP_SESSION_CLASS(k) (CAMEL_CHECK_CLASS_CAST ((k), CAMEL_PGP_SESSION_TYPE, CamelPgpSessionClass)) -#define CAMEL_PGP_IS_SESSION(o) (CAMEL_CHECK_TYPE((o), CAMEL_PGP_SESSION_TYPE)) - - -typedef struct _CamelPgpSession { - CamelSession parent_object; - -} CamelPgpSession; - -typedef struct _CamelPgpSessionClass { - CamelSessionClass parent_class; - -} CamelPgpSessionClass; - - -static char *get_password (CamelSession *session, const char *prompt, - gboolean secret, CamelService *service, - const char *item, CamelException *ex); - -static void -init (CamelPgpSession *session) -{ - ; -} - -static void -class_init (CamelPgpSessionClass *camel_pgp_session_class) -{ - CamelSessionClass *camel_session_class = - CAMEL_SESSION_CLASS (camel_pgp_session_class); - - /* virtual method override */ - camel_session_class->get_password = get_password; -} - -static CamelType -camel_pgp_session_get_type (void) -{ - static CamelType type = CAMEL_INVALID_TYPE; - - if (type == CAMEL_INVALID_TYPE) { - type = camel_type_register ( - camel_test_session_get_type (), - "CamelPgpSession", - sizeof (CamelPgpSession), - sizeof (CamelPgpSessionClass), - (CamelObjectClassInitFunc) class_init, - NULL, - (CamelObjectInitFunc) init, - NULL); - } - - return type; -} - -static char * -get_password (CamelSession *session, const char *prompt, gboolean secret, - CamelService *service, const char *item, CamelException *ex) -{ - return g_strdup ("PGP/MIME is rfc2015, now go and read it."); -} - -static CamelSession * -camel_pgp_session_new (const char *path) -{ - CamelSession *session; - - session = CAMEL_SESSION (camel_object_new (CAMEL_PGP_SESSION_TYPE)); - - camel_session_construct (session, path); - - return session; -} - - -int main (int argc, char **argv) -{ - CamelSession *session; - CamelCipherContext *ctx; - CamelException *ex; - CamelCipherValidity *valid; - CamelStream *stream1, *stream2, *stream3; - GPtrArray *recipients; - GByteArray *buf; - char *before, *after; - - camel_test_init (argc, argv); - - ex = camel_exception_new (); - - /* clear out any camel-test data */ - system("/bin/rm -rf /tmp/camel-test"); - - session = camel_pgp_session_new ("/tmp/camel-test"); - - ctx = camel_gpg_context_new (session, "/usr/bin/gpg"); - camel_gpg_context_set_always_trust (CAMEL_GPG_CONTEXT (ctx), TRUE); - - camel_test_start ("Test of PGP functions"); - - stream1 = camel_stream_mem_new (); - camel_stream_write (stream1, "Hello, I am a test stream.\n", 27); - camel_stream_reset (stream1); - - stream2 = camel_stream_mem_new (); - - camel_test_push ("PGP signing"); - camel_cipher_sign (ctx, "pgp-mime@xtorshun.org", CAMEL_CIPHER_HASH_SHA1, - stream1, stream2, ex); - check_msg (!camel_exception_is_set (ex), "%s", camel_exception_get_description (ex)); - camel_test_pull (); - - camel_exception_clear (ex); - - camel_test_push ("PGP verify"); - camel_stream_reset (stream1); - camel_stream_reset (stream2); - valid = camel_cipher_verify (ctx, CAMEL_CIPHER_HASH_SHA1, stream1, stream2, ex); - check_msg (!camel_exception_is_set (ex), "%s", camel_exception_get_description (ex)); - check_msg (camel_cipher_validity_get_valid (valid), "%s", camel_cipher_validity_get_description (valid)); - camel_cipher_validity_free (valid); - camel_test_pull (); - - camel_object_unref (CAMEL_OBJECT (stream1)); - camel_object_unref (CAMEL_OBJECT (stream2)); - - stream1 = camel_stream_mem_new (); - stream2 = camel_stream_mem_new (); - stream3 = camel_stream_mem_new (); - - camel_stream_write (stream1, "Hello, I am a test of encryption/decryption.", 44); - camel_stream_reset (stream1); - - camel_exception_clear (ex); - - camel_test_push ("PGP encrypt"); - recipients = g_ptr_array_new (); - g_ptr_array_add (recipients, "pgp-mime@xtorshun.org"); - camel_cipher_encrypt (ctx, FALSE, "pgp-mime@xtorshun.org", recipients, - stream1, stream2, ex); - check_msg (!camel_exception_is_set (ex), "%s", camel_exception_get_description (ex)); - g_ptr_array_free (recipients, TRUE); - camel_test_pull (); - - camel_stream_reset (stream2); - camel_exception_clear (ex); - - camel_test_push ("PGP decrypt"); - camel_cipher_decrypt (ctx, stream2, stream3, ex); - check_msg (!camel_exception_is_set (ex), "%s", camel_exception_get_description (ex)); - buf = CAMEL_STREAM_MEM (stream1)->buffer; - before = g_strndup (buf->data, buf->len); - buf = CAMEL_STREAM_MEM (stream3)->buffer; - after = g_strndup (buf->data, buf->len); - check_msg (string_equal (before, after), "before = '%s', after = '%s'", before, after); - g_free (before); - g_free (after); - camel_test_pull (); - - camel_object_unref (CAMEL_OBJECT (ctx)); - camel_object_unref (CAMEL_OBJECT (session)); - - camel_test_end (); - - return 0; -} diff --git a/camel/tests/smime/pkcs7.c b/camel/tests/smime/pkcs7.c deleted file mode 100644 index 2248d8656d..0000000000 --- a/camel/tests/smime/pkcs7.c +++ /dev/null @@ -1,178 +0,0 @@ -#include <config.h> - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <camel/camel-smime-context.h> -#include <camel/camel-stream-mem.h> - -#include "camel-test.h" - - -#define CAMEL_TEST_SESSION_TYPE (camel_test_session_get_type ()) -#define CAMEL_TEST_SESSION(obj) (CAMEL_CHECK_CAST((obj), CAMEL_TEST_SESSION_TYPE, CamelTestSession)) -#define CAMEL_TEST_SESSION_CLASS(k) (CAMEL_CHECK_CLASS_CAST ((k), CAMEL_TEST_SESSION_TYPE, CamelTestSessionClass)) -#define CAMEL_TEST_IS_SESSION(o) (CAMEL_CHECK_TYPE((o), CAMEL_TEST_SESSION_TYPE)) - - -typedef struct _CamelTestSession { - CamelSession parent_object; - -} CamelTestSession; - -typedef struct _CamelTestSessionClass { - CamelSessionClass parent_class; - -} CamelTestSessionClass; - - -static char *get_password (CamelSession *session, const char *prompt, - gboolean secret, CamelService *service, - const char *item, CamelException *ex); - -static void -init (CamelTestSession *session) -{ - ; -} - -static void -class_init (CamelTestSessionClass *camel_test_session_class) -{ - CamelSessionClass *camel_session_class = - CAMEL_SESSION_CLASS (camel_test_session_class); - - /* virtual method override */ - camel_session_class->get_password = get_password; -} - -static CamelType -camel_test_session_get_type (void) -{ - static CamelType type = CAMEL_INVALID_TYPE; - - if (type == CAMEL_INVALID_TYPE) { - type = camel_type_register ( - camel_test_session_get_type (), - "CamelTestSession", - sizeof (CamelTestSession), - sizeof (CamelTestSessionClass), - (CamelObjectClassInitFunc) class_init, - NULL, - (CamelObjectInitFunc) init, - NULL); - } - - return type; -} - -static char * -get_password (CamelSession *session, const char *prompt, gboolean secret, - CamelService *service, const char *item, CamelException *ex) -{ - return g_strdup ("S/MIME v3 is rfc263x, now go and read them."); -} - -static CamelSession * -camel_test_session_new (const char *path) -{ - CamelSession *session; - - session = CAMEL_SESSION (camel_object_new (CAMEL_TEST_SESSION_TYPE)); - - camel_session_construct (session, path); - - return session; -} - - -int main (int argc, char **argv) -{ - CamelSession *session; - CamelSMimeContext *ctx; - CamelException *ex; - CamelCipherValidity *valid; - CamelStream *stream1, *stream2, *stream3; - GPtrArray *recipients; - GByteArray *buf; - char *before, *after; - - camel_test_init (argc, argv); - - ex = camel_exception_new (); - - /* clear out any camel-test data */ - system ("/bin/rm -rf /tmp/camel-test"); - - session = camel_test_session_new ("/tmp/camel-test"); - - ctx = camel_smime_context_new (session); - - camel_test_start ("Test of S/MIME PKCS7 functions"); - - stream1 = camel_stream_mem_new (); - camel_stream_write (stream1, "Hello, I am a test stream.", 25); - camel_stream_reset (stream1); - - stream2 = camel_stream_mem_new (); - - camel_test_push ("PKCS7 signing"); - camel_smime_sign (ctx, "smime@xtorshun.org", CAMEL_CIPHER_HASH_SHA1, - stream1, stream2, ex); - check_msg (!camel_exception_is_set (ex), "%s", camel_exception_get_description (ex)); - camel_test_pull (); - - camel_exception_clear (ex); - - camel_test_push ("PKCS7 verify"); - camel_stream_reset (stream1); - camel_stream_reset (stream2); - valid = camel_smime_verify (ctx, CAMEL_CIPHER_HASH_SHA1, stream1, stream2, ex); - check_msg (!camel_exception_is_set (ex), "%s", camel_exception_get_description (ex)); - check_msg (camel_cipher_validity_get_valid (valid), "%s", camel_cipher_validity_get_description (valid)); - camel_cipher_validity_free (valid); - camel_test_pull (); - - camel_object_unref (CAMEL_OBJECT (stream1)); - camel_object_unref (CAMEL_OBJECT (stream2)); - - stream1 = camel_stream_mem_new (); - stream2 = camel_stream_mem_new (); - stream3 = camel_stream_mem_new (); - - camel_stream_write (stream1, "Hello, I am a test of encryption/decryption.", 44); - camel_stream_reset (stream1); - - camel_exception_clear (ex); - - camel_test_push ("PKCS7 encrypt"); - recipients = g_ptr_array_new (); - g_ptr_array_add (recipients, "smime@xtorshun.org"); - camel_smime_encrypt (ctx, FALSE, "smime@xtorshun.org", recipients, - stream1, stream2, ex); - check_msg (!camel_exception_is_set (ex), "%s", camel_exception_get_description (ex)); - g_ptr_array_free (recipients, TRUE); - camel_test_pull (); - - camel_stream_reset (stream2); - camel_exception_clear (ex); - - camel_test_push ("PKCS7 decrypt"); - camel_smime_decrypt (ctx, stream2, stream3, ex); - check_msg (!camel_exception_is_set (ex), "%s", camel_exception_get_description (ex)); - buf = CAMEL_STREAM_MEM (stream1)->buffer; - before = g_strndup (buf->data, buf->len); - buf = CAMEL_STREAM_MEM (stream3)->buffer; - after = g_strndup (buf->data, buf->len); - check_msg (string_equal (before, after), "before = '%s', after = '%s'", before, after); - g_free (before); - g_free (after); - camel_test_pull (); - - camel_object_unref (CAMEL_OBJECT (ctx)); - camel_object_unref (CAMEL_OBJECT (session)); - - camel_test_end (); - - return 0; -} diff --git a/camel/tests/stream/.cvsignore b/camel/tests/stream/.cvsignore deleted file mode 100644 index 36f9336c1d..0000000000 --- a/camel/tests/stream/.cvsignore +++ /dev/null @@ -1,14 +0,0 @@ -.deps -Makefile -Makefile.in -.libs -.deps -*.lo -*.la -*.bb -*.bbg -*.da -*.gcov -test1 -test2 -test3 diff --git a/camel/tests/stream/Makefile.am b/camel/tests/stream/Makefile.am deleted file mode 100644 index 25bd84eafd..0000000000 --- a/camel/tests/stream/Makefile.am +++ /dev/null @@ -1,25 +0,0 @@ - -INCLUDES = \ - -I$(includedir) \ - -I$(top_srcdir) \ - -I$(top_srcdir)/intl \ - -I$(top_srcdir)/e-util \ - -I$(top_srcdir)/camel \ - -I$(top_srcdir)/camel/tests/lib \ - -DG_LOG_DOMAIN=\"evolution-tests\" \ - $(CAMEL_CFLAGS) - -LDADD = \ - $(top_builddir)/camel/libcamel.la \ - $(top_builddir)/e-util/libeutil.la \ - $(top_builddir)/camel/tests/lib/libcameltest.a \ - $(INTLLIBS) \ - $(EVOLUTION_MAIL_LIBS) - -check_PROGRAMS = \ - test1 test2 test3 - -TESTS = test1 test2 test3 - - - diff --git a/camel/tests/stream/README b/camel/tests/stream/README deleted file mode 100644 index 8ca6a9602d..0000000000 --- a/camel/tests/stream/README +++ /dev/null @@ -1,4 +0,0 @@ - -test1 camelstreamfs, creating, read/write, eos, refcounting -test2 camelstreammem, creating, read/write, eos, refcounting -test3 camelseekablesubstream diff --git a/camel/tests/stream/test1.c b/camel/tests/stream/test1.c deleted file mode 100644 index 452d45274f..0000000000 --- a/camel/tests/stream/test1.c +++ /dev/null @@ -1,119 +0,0 @@ -/* - test ... camelstreamfs */ - -#include "camel-test.h" -#include "streams.h" - -#include <errno.h> -#include <sys/stat.h> -#include <unistd.h> - -#include "camel/camel-stream-fs.h" - -int main(int argc, char **argv) -{ - CamelSeekableStream *ss = NULL; - int i; - int fd = -1; - struct stat st; - int size; - char buffer[1024]; - - camel_test_init(argc, argv); - - camel_test_start("CamelStream fs, open, seek, read, write, eos"); - for (i=0;i<2;i++) { - - (void)unlink("stream.txt"); - - push("trying to open a nonexistant stream, method %d", i); - switch(i) { - case 0: - ss = (CamelSeekableStream *)camel_stream_fs_new_with_name("stream.txt", O_RDWR, 0); - break; - case 1: - fd = open("stream.txt", O_RDWR, 0); - ss = (CamelSeekableStream *)camel_stream_fs_new_with_fd(fd); - break; - } - check(ss == NULL && errno == ENOENT); - check(stat("stream.txt", &st) == -1 && errno == ENOENT); - pull(); - - push("Creating stream using method %d", i); - switch(i) { - case 0: - ss = (CamelSeekableStream *)camel_stream_fs_new_with_name("stream.txt", O_CREAT|O_RDWR|O_TRUNC, 0600); - fd = ((CamelStreamFs *)ss)->fd; - break; - case 1: - fd = open("stream.txt", O_CREAT|O_RDWR|O_TRUNC, 0600); - ss = (CamelSeekableStream *)camel_stream_fs_new_with_fd(fd); - break; - } - check(ss != NULL); - check(stat("stream.txt", &st) == 0 && (st.st_mode&0777) == 0600 && S_ISREG(st.st_mode) && st.st_size == 0); - pull(); - - test_stream_seekable_writepart(ss); - test_stream_seekable_readpart(ss); - - push("getting filesize"); - check(stat("stream.txt", &st) == 0 && (st.st_mode&0777) == 0600 && S_ISREG(st.st_mode)); - size = st.st_size; - pull(); - - push("checking close closes"); - check_unref(ss, 1); - check(close(fd) == -1); - pull(); - - push("re-opening stream"); - switch(i) { - case 0: - ss = (CamelSeekableStream *)camel_stream_fs_new_with_name("stream.txt", O_RDWR, 0); - fd = ((CamelStreamFs *)ss)->fd; - break; - case 1: - fd = open("stream.txt", O_RDWR, 0); - ss = (CamelSeekableStream *)camel_stream_fs_new_with_fd(fd); - break; - } - check(ss != NULL); - check(stat("stream.txt", &st) == 0 && (st.st_mode&0777) == 0600 && S_ISREG(st.st_mode) && st.st_size == size); - - test_stream_seekable_readpart(ss); - - check_unref(ss, 1); - check(close(fd) == -1); - pull(); - - push("re-opening stream with truncate"); - switch(i) { - case 0: - ss = (CamelSeekableStream *)camel_stream_fs_new_with_name("stream.txt", O_RDWR|O_TRUNC, 0); - fd = ((CamelStreamFs *)ss)->fd; - break; - case 1: - fd = open("stream.txt", O_RDWR|O_TRUNC, 0); - ss = (CamelSeekableStream *)camel_stream_fs_new_with_fd(fd); - break; - } - check(ss != NULL); - check(stat("stream.txt", &st) == 0 && (st.st_mode&0777) == 0600 && S_ISREG(st.st_mode) && st.st_size == 0); - - /* read has to return 0 before eos is set */ - check(camel_stream_read(CAMEL_STREAM(ss), buffer, 1) == 0); - check(camel_stream_eos(CAMEL_STREAM(ss))); - - check_unref(ss, 1); - check(close(fd) == -1); - pull(); - - (void)unlink("stream.txt"); - } - - camel_test_end(); - - return 0; -} diff --git a/camel/tests/stream/test2.c b/camel/tests/stream/test2.c deleted file mode 100644 index 02ad88e95c..0000000000 --- a/camel/tests/stream/test2.c +++ /dev/null @@ -1,53 +0,0 @@ -/* - test ... camelstreammem */ - -#include "camel-test.h" -#include "streams.h" - -#include <errno.h> -#include <sys/stat.h> -#include <unistd.h> - -#include "camel/camel-stream-mem.h" - -int main(int argc, char **argv) -{ - CamelSeekableStream *ss = NULL; - int i; - int fd = -1; - struct stat st; - int size; - char buffer[1024]; - GByteArray *ba; - - camel_test_init(argc, argv); - - camel_test_start("CamelStream mem, create, seek, read, write, eos"); - for (i=0;i<3;i++) { - - push("Creating stream using method %d", i); - switch(i) { - case 0: - ss = (CamelSeekableStream *)camel_stream_mem_new(); - break; - case 1: - ba = g_byte_array_new(); - ss = (CamelSeekableStream *)camel_stream_mem_new_with_byte_array(ba); - break; - case 2: - ss = (CamelSeekableStream *)camel_stream_mem_new_with_buffer("", 0); - break; - } - check(ss != NULL); - - test_stream_seekable_writepart(ss); - test_stream_seekable_readpart(ss); - - check_unref(ss, 1); - pull(); - } - - camel_test_end(); - - return 0; -} diff --git a/camel/tests/stream/test3.c b/camel/tests/stream/test3.c deleted file mode 100644 index f85a8ce105..0000000000 --- a/camel/tests/stream/test3.c +++ /dev/null @@ -1,104 +0,0 @@ -/* - test ... camelseekablesubstream */ - -#include "camel-test.h" -#include "streams.h" - -#include <errno.h> -#include <sys/stat.h> -#include <unistd.h> - -#include "camel/camel-stream-mem.h" -#include "camel/camel-stream-fs.h" -#include "camel/camel-seekable-substream.h" - -#define ARRAY_LEN(x) (sizeof(x)/sizeof(x[0])) - -struct { - off_t lower, upper; -} ranges[] = { - { 3, 10241 }, - { 0, 1024 }, - { 0, 0 }, - { 0, 1 }, - { 0, 2 }, - { 0, 3 }, - { 0, 7 }, - { 1, 8 }, - { 1, 9 }, - { 10245, 10300 }, - { 0, CAMEL_STREAM_UNBOUND }, -/* { 1, CAMEL_STREAM_UNBOUND }, - { 2, CAMEL_STREAM_UNBOUND }, - { 3, CAMEL_STREAM_UNBOUND }, these take too long to run - { 7, CAMEL_STREAM_UNBOUND },*/ - { 10245, CAMEL_STREAM_UNBOUND }, -}; - -int main(int argc, char **argv) -{ - CamelSeekableStream *ss = NULL; - int i, j; - CamelSeekableSubstream *sus, *sus2; - - camel_test_init(argc, argv); - - camel_test_start("CamelSeekableSubstream, mem backing"); - for (j=0;j<SEEKABLE_SUBSTREAM_WAYS;j++) { - push("testing writing method %d", j); - ss = (CamelSeekableStream *)camel_stream_mem_new(); - check(ss != NULL); - for (i=0;i<ARRAY_LEN(ranges);i++) { - push("stream subrange %d-%d", ranges[i].lower, ranges[i].upper); - sus = (CamelSeekableSubstream *)camel_seekable_substream_new(ss, ranges[i].lower, ranges[i].upper); - check(sus != NULL); - - test_seekable_substream_writepart((CamelStream *)sus, j); - test_seekable_substream_readpart((CamelStream *)sus); - - sus2 = (CamelSeekableSubstream *)camel_seekable_substream_new(ss, ranges[i].lower, ranges[i].upper); - check(sus2 != NULL); - test_seekable_substream_readpart((CamelStream *)sus2); - - check_unref(sus, 1); - check_unref(sus2, 1); - pull(); - } - check_unref(ss, 1); - pull(); - } - - camel_test_end(); - - (void)unlink("stream.txt"); - - camel_test_start("CamelSeekableSubstream, file backing"); - for (j=0;j<SEEKABLE_SUBSTREAM_WAYS;j++) { - push("testing writing method %d", j); - ss = (CamelSeekableStream *)camel_stream_fs_new_with_name("stream.txt", O_RDWR|O_CREAT|O_TRUNC, 0600); - check(ss != NULL); - for (i=0;i<ARRAY_LEN(ranges);i++) { - push("stream subrange %d-%d", ranges[i].lower, ranges[i].upper); - sus = (CamelSeekableSubstream *)camel_seekable_substream_new(ss, ranges[i].lower, ranges[i].upper); - check(sus != NULL); - - test_seekable_substream_writepart((CamelStream *)sus, j); - test_seekable_substream_readpart((CamelStream *)sus); - - sus2 = (CamelSeekableSubstream *)camel_seekable_substream_new(ss, ranges[i].lower, ranges[i].upper); - check(sus2 != NULL); - test_seekable_substream_readpart((CamelStream *)sus2); - - check_unref(sus, 1); - check_unref(sus2, 1); - pull(); - } - check_unref(ss, 1); - (void)unlink("stream.txt"); - pull(); - } - - camel_test_end(); - - return 0; -} |