From fba011bf008443ee5130f1426aa65e11245cd84a Mon Sep 17 00:00:00 2001 From: JP Rosevear Date: Tue, 11 Jan 2005 00:00:07 +0000 Subject: Kill dead files svn path=/trunk/; revision=28342 --- camel/tests/.cvsignore | 7 - camel/tests/Makefile.am | 3 - camel/tests/README | 44 -- camel/tests/data/camel-test.gpg.pub | 24 - camel/tests/data/camel-test.gpg.sec | 33 -- camel/tests/data/gendoc.pl | 65 --- camel/tests/data/genline.pl | 72 --- camel/tests/data/getaddr.pl | 32 -- camel/tests/data/messages/.cvsignore | 1 - camel/tests/folder/.cvsignore | 21 - camel/tests/folder/Makefile.am | 28 -- camel/tests/folder/README | 12 - camel/tests/folder/test1.c | 56 --- camel/tests/folder/test10.c | 106 ---- camel/tests/folder/test2.c | 62 --- camel/tests/folder/test3.c | 339 ------------- camel/tests/folder/test4.c | 57 --- camel/tests/folder/test5.c | 57 --- camel/tests/folder/test6.c | 59 --- camel/tests/folder/test7.c | 58 --- camel/tests/folder/test8.c | 209 -------- camel/tests/folder/test9.c | 231 --------- camel/tests/lib/.cvsignore | 12 - camel/tests/lib/Makefile.am | 32 -- camel/tests/lib/address-data.h | 93 ---- camel/tests/lib/addresses.c | 54 -- camel/tests/lib/addresses.h | 5 - camel/tests/lib/camel-test.c | 355 -------------- camel/tests/lib/camel-test.h | 68 --- camel/tests/lib/folders.c | 570 ---------------------- camel/tests/lib/folders.h | 20 - camel/tests/lib/messages.c | 290 ----------- camel/tests/lib/messages.h | 18 - camel/tests/lib/session.c | 44 -- camel/tests/lib/session.h | 19 - camel/tests/lib/streams.c | 242 --------- camel/tests/lib/streams.h | 12 - camel/tests/message/.cvsignore | 15 - camel/tests/message/Makefile.am | 23 - camel/tests/message/README | 9 - camel/tests/message/test1.c | 201 -------- camel/tests/message/test2.c | 326 ------------- camel/tests/message/test3.c | 199 -------- camel/tests/message/test4.c | 129 ----- camel/tests/mime-filter/.cvsignore | 8 - camel/tests/mime-filter/Makefile.am | 34 -- camel/tests/mime-filter/charset-gb2312.0.in | 448 ----------------- camel/tests/mime-filter/charset-gb2312.0.out | 448 ----------------- camel/tests/mime-filter/charset-iso-2022-jp.0.in | 5 - camel/tests/mime-filter/charset-iso-2022-jp.0.out | 5 - camel/tests/mime-filter/crlf-1.in | 19 - camel/tests/mime-filter/crlf-1.out | 19 - camel/tests/mime-filter/data/html.0.in | 10 - camel/tests/mime-filter/data/html.0.out | 10 - camel/tests/mime-filter/data/html.1.in | 10 - camel/tests/mime-filter/data/html.1.out | 10 - camel/tests/mime-filter/test-charset.c | 140 ------ camel/tests/mime-filter/test-crlf.c | 160 ------ camel/tests/mime-filter/test-tohtml.c | 132 ----- camel/tests/misc/.cvsignore | 14 - camel/tests/misc/Makefile.am | 28 -- camel/tests/misc/README | 5 - camel/tests/misc/split.c | 113 ----- camel/tests/misc/test2.c | 121 ----- camel/tests/misc/url-scan.c | 132 ----- camel/tests/misc/url.c | 123 ----- camel/tests/misc/utf7.c | 106 ---- camel/tests/smime/.cvsignore | 5 - camel/tests/smime/Makefile.am | 23 - camel/tests/smime/README | 2 - camel/tests/smime/pgp-mime.c | 214 -------- camel/tests/smime/pgp.c | 250 ---------- camel/tests/smime/pkcs7.c | 178 ------- camel/tests/stream/.cvsignore | 14 - camel/tests/stream/Makefile.am | 23 - camel/tests/stream/README | 4 - camel/tests/stream/test1.c | 119 ----- camel/tests/stream/test2.c | 53 -- camel/tests/stream/test3.c | 104 ---- 79 files changed, 7401 deletions(-) delete mode 100644 camel/tests/.cvsignore delete mode 100644 camel/tests/Makefile.am delete mode 100644 camel/tests/README delete mode 100644 camel/tests/data/camel-test.gpg.pub delete mode 100644 camel/tests/data/camel-test.gpg.sec delete mode 100755 camel/tests/data/gendoc.pl delete mode 100755 camel/tests/data/genline.pl delete mode 100755 camel/tests/data/getaddr.pl delete mode 100644 camel/tests/data/messages/.cvsignore delete mode 100644 camel/tests/folder/.cvsignore delete mode 100644 camel/tests/folder/Makefile.am delete mode 100644 camel/tests/folder/README delete mode 100644 camel/tests/folder/test1.c delete mode 100644 camel/tests/folder/test10.c delete mode 100644 camel/tests/folder/test2.c delete mode 100644 camel/tests/folder/test3.c delete mode 100644 camel/tests/folder/test4.c delete mode 100644 camel/tests/folder/test5.c delete mode 100644 camel/tests/folder/test6.c delete mode 100644 camel/tests/folder/test7.c delete mode 100644 camel/tests/folder/test8.c delete mode 100644 camel/tests/folder/test9.c delete mode 100644 camel/tests/lib/.cvsignore delete mode 100644 camel/tests/lib/Makefile.am delete mode 100644 camel/tests/lib/address-data.h delete mode 100644 camel/tests/lib/addresses.c delete mode 100644 camel/tests/lib/addresses.h delete mode 100644 camel/tests/lib/camel-test.c delete mode 100644 camel/tests/lib/camel-test.h delete mode 100644 camel/tests/lib/folders.c delete mode 100644 camel/tests/lib/folders.h delete mode 100644 camel/tests/lib/messages.c delete mode 100644 camel/tests/lib/messages.h delete mode 100644 camel/tests/lib/session.c delete mode 100644 camel/tests/lib/session.h delete mode 100644 camel/tests/lib/streams.c delete mode 100644 camel/tests/lib/streams.h delete mode 100644 camel/tests/message/.cvsignore delete mode 100644 camel/tests/message/Makefile.am delete mode 100644 camel/tests/message/README delete mode 100644 camel/tests/message/test1.c delete mode 100644 camel/tests/message/test2.c delete mode 100644 camel/tests/message/test3.c delete mode 100644 camel/tests/message/test4.c delete mode 100644 camel/tests/mime-filter/.cvsignore delete mode 100644 camel/tests/mime-filter/Makefile.am delete mode 100644 camel/tests/mime-filter/charset-gb2312.0.in delete mode 100644 camel/tests/mime-filter/charset-gb2312.0.out delete mode 100644 camel/tests/mime-filter/charset-iso-2022-jp.0.in delete mode 100644 camel/tests/mime-filter/charset-iso-2022-jp.0.out delete mode 100644 camel/tests/mime-filter/crlf-1.in delete mode 100644 camel/tests/mime-filter/crlf-1.out delete mode 100644 camel/tests/mime-filter/data/html.0.in delete mode 100644 camel/tests/mime-filter/data/html.0.out delete mode 100644 camel/tests/mime-filter/data/html.1.in delete mode 100644 camel/tests/mime-filter/data/html.1.out delete mode 100644 camel/tests/mime-filter/test-charset.c delete mode 100644 camel/tests/mime-filter/test-crlf.c delete mode 100644 camel/tests/mime-filter/test-tohtml.c delete mode 100644 camel/tests/misc/.cvsignore delete mode 100644 camel/tests/misc/Makefile.am delete mode 100644 camel/tests/misc/README delete mode 100644 camel/tests/misc/split.c delete mode 100644 camel/tests/misc/test2.c delete mode 100644 camel/tests/misc/url-scan.c delete mode 100644 camel/tests/misc/url.c delete mode 100644 camel/tests/misc/utf7.c delete mode 100644 camel/tests/smime/.cvsignore delete mode 100644 camel/tests/smime/Makefile.am delete mode 100644 camel/tests/smime/README delete mode 100644 camel/tests/smime/pgp-mime.c delete mode 100644 camel/tests/smime/pgp.c delete mode 100644 camel/tests/smime/pkcs7.c delete mode 100644 camel/tests/stream/.cvsignore delete mode 100644 camel/tests/stream/Makefile.am delete mode 100644 camel/tests/stream/README delete mode 100644 camel/tests/stream/test1.c delete mode 100644 camel/tests/stream/test2.c delete mode 100644 camel/tests/stream/test3.c (limited to 'camel/tests') 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 diff --git a/camel/tests/data/camel-test.gpg.pub b/camel/tests/data/camel-test.gpg.pub deleted file mode 100644 index fdf28a59bd..0000000000 --- a/camel/tests/data/camel-test.gpg.pub +++ /dev/null @@ -1,24 +0,0 @@ ------BEGIN PGP PUBLIC KEY BLOCK----- -Version: GnuPG v1.0.7 (GNU/Linux) - -mQGiBD8qsjARBACkS39GA1e6pDUumC9sQyZaE2PEZW6VEHMGQ9IlJ/Qi2wJBFKgl -Myl2Cko9Rpj2DmgGkBnoL6fPJNM9aCV0RvclvE15EViURU7mjYzF41uspvVMBg7b -y3cwAzkkgyhLc/V0Inzm9UpJZ6JvrqYO5OvJUA+ka5SHrhuX4ptmjKLjNwCgwNCx -CQHx9RIbPggYtfci1w9npm8D/3vks1q+G9r91JkRBqGTboBZ7HI1yU2tHJ38wsKp -kamloFr3j0hmN0s5PY4wgz4daJ120yTmweJQfIljcN2+aHeI5838u7f3Wk5LJtLG -+0xKBpBeejzqT/FzhxLIOoQl3L8aF+KAY+Oz7Bm/J/5MRPEPdxWGIB1LhnkoDP5F -5szGA/9POpFU7y34ACid5Grzk77LUVyHMGob+vgqoVITfCNGjfGf7tnXn1LlRf6N -TE81p1vYDz2K4bpPmOgBXuESmpaTfXvlDy6oW7buslFqgddm/MfzzM0wC2jdx5TV -NdNApku4PKA4pE2oTSg5EuGgxQLjJG/PHkoiRiK6yG8gign8vrQbTm8gVXNlciA8 -bm8udXNlckBuby5kb21haW4+iFkEExECABkFAj8qsjAECwcDAgMVAgMDFgIBAh4B -AheAAAoJEOvMhgJ6QMoGIQcAoIweyKELWnksPUk5mmZz26JFsmQVAJ9aTm+OO289 -+fdwq95xw/6KH2dEtrkBDQQ/KrIxEAQA26Y+QRaR7RymzyUW7MQlDbshD/vInLtb -36FusuOWzL5TgYn6fiiu/e/J+qjZO5psucWelnBIbnLTZZJs06EgybLPCeEP34X7 -cSsAPZ2JE+TKPM93pxpQpRdWKhv+ocjJ4xPlwI8LTrQIHKxB3yF2WNCh/TQDi0hm -6ktEi2RVusMAAwUD/3Wp0UbJ2/bgM9wOMAD8celvbl9V/L+9/UVBJrw4tH87FMZi -NMNg13TbMrARqJjdpOoHzozMv1GOumC5sE8A0/pwbIdU9oSYA07D3+02dCQq+52a -qtCGJoRq5okccQelRcs0cZIy/z5lzwsNnbshrmnqNdmuVf7BSdw7DjoFj5OLiEYE -GBECAAYFAj8qsjEACgkQ68yGAnpAygZaCgCfZu68SOUfcUZC3CWi4ITBvcKGvmUA -n1wrC5ZGv0SIRo5G1PswsKRZuEpl -=SWoX ------END PGP PUBLIC KEY BLOCK----- diff --git a/camel/tests/data/camel-test.gpg.sec b/camel/tests/data/camel-test.gpg.sec deleted file mode 100644 index f2af11e82e..0000000000 --- a/camel/tests/data/camel-test.gpg.sec +++ /dev/null @@ -1,33 +0,0 @@ ------BEGIN PGP PRIVATE KEY BLOCK----- -Version: GnuPG v1.0.7 (GNU/Linux) - -lQHhBD8qsjARBACkS39GA1e6pDUumC9sQyZaE2PEZW6VEHMGQ9IlJ/Qi2wJBFKgl -Myl2Cko9Rpj2DmgGkBnoL6fPJNM9aCV0RvclvE15EViURU7mjYzF41uspvVMBg7b -y3cwAzkkgyhLc/V0Inzm9UpJZ6JvrqYO5OvJUA+ka5SHrhuX4ptmjKLjNwCgwNCx -CQHx9RIbPggYtfci1w9npm8D/3vks1q+G9r91JkRBqGTboBZ7HI1yU2tHJ38wsKp -kamloFr3j0hmN0s5PY4wgz4daJ120yTmweJQfIljcN2+aHeI5838u7f3Wk5LJtLG -+0xKBpBeejzqT/FzhxLIOoQl3L8aF+KAY+Oz7Bm/J/5MRPEPdxWGIB1LhnkoDP5F -5szGA/9POpFU7y34ACid5Grzk77LUVyHMGob+vgqoVITfCNGjfGf7tnXn1LlRf6N -TE81p1vYDz2K4bpPmOgBXuESmpaTfXvlDy6oW7buslFqgddm/MfzzM0wC2jdx5TV -NdNApku4PKA4pE2oTSg5EuGgxQLjJG/PHkoiRiK6yG8gign8vv4DAwJKsiNZxDAs -LGBFwzjlfD8Wpo+OQQSuw8kHCJRhMpjBlkWYXuAIXrPVJBZmr3hYQbaL413EFp0w -DeQUzP0mIzpEU0FfZmFjdG9yOgAAr2ShZqfqP4RkV02MsarSDNg/K9RXc5f9JiM6 -RFNBX2ZhY3RvcjoAAK9F/Ldv8ksX8Ns3uqh8GEEDq88XZIeh/SYjOkRTQV9mYWN0 -b3I6AACvaOM+Tasvvj5+aQ3E44IHW8xzeXdM5bQbTm8gVXNlciA8bm8udXNlckBu -by5kb21haW4+iFkEExECABkFAj8qsjAECwcDAgMVAgMDFgIBAh4BAheAAAoJEOvM -hgJ6QMoGIQcAniz8Z+AESmwwrtQpllkLWaXQhkNMAJ4yqLAKSsfimKf3BDjxUzJ5 -6RKTE50BVwQ/KrIxEAQA26Y+QRaR7RymzyUW7MQlDbshD/vInLtb36FusuOWzL5T -gYn6fiiu/e/J+qjZO5psucWelnBIbnLTZZJs06EgybLPCeEP34X7cSsAPZ2JE+TK -PM93pxpQpRdWKhv+ocjJ4xPlwI8LTrQIHKxB3yF2WNCh/TQDi0hm6ktEi2RVusMA -AwUD/3Wp0UbJ2/bgM9wOMAD8celvbl9V/L+9/UVBJrw4tH87FMZiNMNg13TbMrAR -qJjdpOoHzozMv1GOumC5sE8A0/pwbIdU9oSYA07D3+02dCQq+52aqtCGJoRq5okc -cQelRcs0cZIy/z5lzwsNnbshrmnqNdmuVf7BSdw7DjoFj5OL/gMDAkqyI1nEMCws -YMk7XUGj7+BY1uyYyNpYp50F52HFsGXEffiKYPGIuybuP+Yz3ic4W9aQTJJPcIJg -ZqUP9b14WfY4mgIm1Tz9JiM6RUxHX2ZhY3RvcjoAAKsH4JdVQugM+lGnuNuGoj7I -V8O8bIsP/SYjOkVMR19mYWN0b3I6AACrBzvFd1NLrbYGMjsN3SKhgBtuHjGQx/0m -IzpFTEdfZmFjdG9yOgAAqwR77L22dgo/dV8XO8NThXMbEmQgoY39JiM6RUxHX2Zh -Y3RvcjoAAKsFRPzjSodiTFMeiwWHgpdgf4e2qzEN/SYjOkVMR19mYWN0b3I6AACr -BX9hqiLZJKfgpo/hs/0wK8yHq6GXh4hGBBgRAgAGBQI/KrIxAAoJEOvMhgJ6QMoG -WgoAoKwAHwpedO9qQNBu0REM1jNR9PuuAJ9ZtHyuOiziV/JageUT+hZ8s27U3A== -=xLRp ------END PGP PRIVATE KEY BLOCK----- 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 () { - if (m/^msgstr \"(.*)\"/) { - $str = $1; - if ($str eq "") { - while () { - 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 () { - if (m/^msgstr \"(.*)\"/) { - $str = $1; - if ($str eq "") { - while () { - if (m/\"(.*)\"/) { - $str .= $1; - } else { - last; - } - } - } - return $str; - } - } - return ""; -} - -$unknown = "x-unknown-1"; -open OUT, ">test-lines.h"; - -print OUT < 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 () { - if (/^From: (.*)/i - || /^To: (.*)/i - || /^Cc: (.*)/i) { - $base = $1; - while () { - if (/^\s+(.*)/) { - $base .= " ".$1; - } else { - last; - } - } - $uniq{$base} = 1; - } - } - close IN; -} - -foreach $key (sort keys %uniq) { - print $key."\n"; -} diff --git a/camel/tests/data/messages/.cvsignore b/camel/tests/data/messages/.cvsignore deleted file mode 100644 index e358dd1903..0000000000 --- a/camel/tests/data/messages/.cvsignore +++ /dev/null @@ -1 +0,0 @@ -*.msg 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 92089a798d..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)/camel \ - -I$(top_srcdir)/camel/tests/lib \ - -DG_LOG_DOMAIN=\"evolution-tests\" \ - $(CAMEL_CFLAGS) - -LDADD = \ - $(top_builddir)/camel/tests/lib/libcameltest.a \ - $(top_builddir)/camel/tests/lib/libcameltest-provider.a \ - $(top_builddir)/camel/libcamel.la \ - $(top_builddir)/camel/libcamel-provider.la \ - $(top_builddir)/libedataserver/libedataserver-${BASE_VERSION}.la \ - $(INTLLIBS) - -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 1f2d33b4c4..0000000000 --- a/camel/tests/folder/test1.c +++ /dev/null @@ -1,56 +0,0 @@ -/* store testing */ - -#include "camel-test.h" -#include "camel-test-provider.h" -#include "folders.h" -#include "session.h" - -#include -#include -#include - -#define ARRAY_LEN(x) (sizeof(x)/sizeof(x[0])) - -static const char *local_drivers[] = { - "local" -}; - -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); - camel_test_provider_init(1, local_drivers); - - 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 -#include - -#include "camel-test.h" -#include "camel-test-provider.h" -#include "folders.h" -#include "messages.h" -#include "session.h" - -#include -#include -#include - -#define MAX_LOOP (10000) -#define MAX_THREADS (5) - -#define d(x) - -#define ARRAY_LEN(x) (sizeof(x)/sizeof(x[0])) - -static const char *local_drivers[] = { "local" }; -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 -#include -#include - -#include "camel-test.h" -#include "camel-test-provider.h" -#include "messages.h" -#include "folders.h" -#include "session.h" - -#include -#include -#include - -#include -#include -#include - -#define ARRAY_LEN(x) (sizeof(x)/sizeof(x[0])) - -static const char *local_drivers[] = { "local" }; - -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); - camel_test_provider_init(1, local_drivers); - - /* 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 - -#include "camel-test.h" -#include "camel-test-provider.h" -#include "messages.h" -#include "folders.h" -#include "session.h" - -#include -#include -#include - -#include -#include -#include - -#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;ilen;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;ilen == 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;jlen;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;jlen;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 fa7955f4e4..0000000000 --- a/camel/tests/folder/test4.c +++ /dev/null @@ -1,57 +0,0 @@ -/* store testing, for remote folders */ - -#include "camel-test.h" -#include "camel-test-provider.h" -#include "folders.h" -#include "session.h" - -#include -#include -#include - -#define ARRAY_LEN(x) (sizeof(x)/sizeof(x[0])) - -static const char *imap_drivers[] = { "imap" }; - -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); - camel_test_provider_init(1, imap_drivers); - - 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 -#include -#include - -#define ARRAY_LEN(x) (sizeof(x)/sizeof(x[0])) - -static const char *nntp_drivers[] = { "nntp" }; - -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); - camel_test_provider_init(1, nntp_drivers); - - 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 -#include -#include - -#include -#include -#include - -#define ARRAY_LEN(x) (sizeof(x)/sizeof(x[0])) - -static const char *imap_drivers[] = { "imap" }; -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); - camel_test_provider_init(1, imap_drivers); - - /* 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 -#include -#include - -#include -#include -#include - -#define ARRAY_LEN(x) (sizeof(x)/sizeof(x[0])) - -static const char *nntp_drivers[] = { "nntp" }; -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); - camel_test_provider_init(1, nntp_drivers); - - /* 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 -#include - -#include "camel-test.h" -#include "camel-test-provider.h" -#include "folders.h" -#include "messages.h" -#include "session.h" - -#include -#include -#include - -#define MAX_MESSAGES (100) -#define MAX_THREADS (10) - -#define d(x) - -#define ARRAY_LEN(x) (sizeof(x)/sizeof(x[0])) - -static const char *local_drivers[] = { "local" }; - -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;ifolder, 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); - camel_test_provider_init(1, local_drivers); - - 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;jid = i*MAX_MESSAGES; - info->folder = folder; - pthread_create(&threads[i], 0, worker, info); - } - - for (i=0;ilen;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; -} diff --git a/camel/tests/folder/test9.c b/camel/tests/folder/test9.c deleted file mode 100644 index 4e4f41730c..0000000000 --- a/camel/tests/folder/test9.c +++ /dev/null @@ -1,231 +0,0 @@ -/* folder/index testing */ - -#include - -#include "camel-test.h" -#include "camel-test-provider.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])) - -static const char *local_drivers[] = { "local" }; - -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", "David Gutiérrez Magallanes " }, - { 1, "\"=?iso-8859-1?Q?Jos=E9?= Antonio Milke G.\" ", "José Antonio Milke G. " }, - { 1, "\"=?iso-8859-2?Q?Hi-Fi_Internert_market_=3D_1.Virtu=E1ln=ED_Internetov=E9_H?= =?iso-8859-2?Q?i-Fi_Studio?=\" ", "Hi-Fi Internert market = 1.Virtuální Internetové Hi-Fi Studio " }, - { 3, "\"James M. Cape\" , =?iso-8859-1?Q?Joaqu=EDn_Cuenca_Abela?= , gnome-hackers@nuclecu.unam.mx", "James M. Cape , Joaquín Cuenca Abela , gnome-hackers@nuclecu.unam.mx" }, - { 1, "=?ISO-8859-1?Q?David_Guti=E9rrez_Magallanes?= ", "David Gutiérrez Magallanes " }, - { 1, "=?ISO-8859-2?Q?Tomasz_K=B3oczko?= ", "Tomasz Kłoczko " }, - { 1, "=?ISO-8859-2?Q?Vladim=EDr_Solnick=FD?= ", "Vladimír Solnický " }, - { 1, "=?iso-8859-1?Q?=22S=F6rensen=2C_Daniel=22?= ", "\"Sörensen, Daniel\" " }, - { 1, "=?iso-8859-1?Q?=C1=C2=AAQ=A7=CA?= ", "ÁªQ§Ê " }, - { 1, "=?iso-8859-1?Q?=C1=C2=AAQ=A7=CA?= ", "ÁªQ§Ê " }, - { 1, "=?iso-8859-1?Q?=C1kos?= Valentinyi ", "Ákos Valentinyi " }, - { 1, "=?iso-8859-1?Q?Joaqu=EDn?= Cuenca Abela ", "Joaquín Cuenca Abela " }, - { 2, "=?iso-8859-1?Q?Joaqu=EDn?= Cuenca Abela , gnome-hackers@nuclecu.unam.mx", "Joaquín Cuenca Abela , gnome-hackers@nuclecu.unam.mx" }, - { 1, "=?iso-8859-1?Q?Joaqu=EDn_Cuenca_Abela?= ", "Joaquín Cuenca Abela " }, - { 1, "=?iso-8859-1?Q?Juantom=E1s=20Garc=EDa?= ", "Juantomás García " }, - { 1, "=?iso-8859-1?Q?Kenneth_ll=E9phaane_Christiansen?= ", "Kenneth lléphaane Christiansen " }, - { 1, "=?iso-8859-1?Q?Kjell_Tage_=D8hman?= ", "Kjell Tage Øhman " }, - { 1, "=?iso-8859-1?Q?Martin_Norb=E4ck?= ", "Martin Norbäck " }, - { 1, "=?iso-8859-1?Q?P=E5llen?= ", "Pållen " }, - { 1, "=?iso-8859-1?Q?Ville_P=E4tsi?= ", "Ville Pätsi " }, - { 1, "=?iso-8859-1?q?Joaqu=EDn?= Cuenca Abela ", "Joaquín Cuenca Abela " }, - { 1, "=?iso-8859-2?Q?Dra=BEen_Ka=E8ar?= ", "Dražen Kačar " }, - /* yep this is right, this isn't valid so doesn't decode at all */ - { 1, "=?windows-1250?Q? \"Jaka Mo=E8nik\" ?= ", "=?windows-1250?Q? Jaka Mo=E8nik ?= " }, - { 3, "George , Juantomas =?ISO-8859-1?Q?Garc=C3=83=C2=ADa?= , gnome-hackers@gnome.org", "George , Juantomas García , gnome-hackers@gnome.org" }, - { 7, "Jon Trowbridge , gnome-1.4-list@gnome.org, gnome-devel-list@gnome.org, gnome-hackers@gnome.org, Dom Lachowicz , =?iso-8859-1?Q?Joaqu=EDn_Cuenca_Abela?= , sam th ", "Jon Trowbridge , gnome-1.4-list@gnome.org, gnome-devel-list@gnome.org, gnome-hackers@gnome.org, Dom Lachowicz , Joaquín Cuenca Abela , sam th " }, - { 6, "Jon Trowbridge , gnome-1.4-list@gnome.org, gnome-devel-list@gnome.org, gnome-hackers@gnome.org, Dom Lachowicz , =?iso-8859-1?Q?Joaqu=EDn_Cuenca_Abela?= ", "Jon Trowbridge , gnome-1.4-list@gnome.org, gnome-devel-list@gnome.org, gnome-hackers@gnome.org, Dom Lachowicz , Joaquín Cuenca Abela " }, - { 1, "Kai =?iso-8859-1?Q?Gro=DFjohann?= ", "Kai Großjohann " }, - { 1, "Kai.Grossjohann@CS.Uni-Dortmund.DE (Kai =?iso-8859-1?q?Gro=DFjohann?=)", "Kai Großjohann " }, - { 1, "Rickard =?iso-8859-1?Q?Nordstr=F6m?= ", "Rickard Nordström " }, - { 1, "Tomasz =?iso-8859-2?q?K=B3oczko?= ", "Tomasz Kłoczko " }, - { 1, "VALCKE =?iso-8859-1?Q?C=E9dric?= ", "VALCKE Cédric " }, - { 1, "Ville =?iso-8859-1?q?P=E4tsi?= ", "Ville Pätsi " }, - { 1, "david@iiia.csic.es (=?ISO-8859-1?Q?David_Guti=E9rrez_Magallanes?=)", "David Gutiérrez Magallanes " }, - { 1, "kloczek@rudy.mif.pg.gda.pl (=?ISO-8859-2?Q?Tomasz_K=B3oczko?=)", "Tomasz Kłoczko " }, - { 1, "lassehp@imv.aau.dk (Lasse =?ISO-8859-1?Q?Hiller=F8e?= Petersen)", "Lasse Hillerøe Petersen " }, - { 1, "ysato@etl.go.jp (Yutaka Sato =?ISO-2022-JP?B?GyRAOjRGI0stGyhK?=)", "Yutaka Sato 佐藤豊 " }, -}; - -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", "Sprvce oken hbe s okrajem okna\n(AfterStep, Enlightenment, FVWM, IceWM, Sawmill)" }, - { "ISO-8859-1", "Vindueshndtering flytter dekorationsvindue istedet\n(AfterStep, Enlightenment, FVWM, IceWM, Sawfish)" }, - { "ISO-8859-1", "Vorschaubilder der Fenster mit dem Bildschirminhalt ausfllen" }, - { "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 salvestusksule.\nKas peaks ta niisama sulgema, vi veel ootama?" }, - { "iso-8859-1", "Lehio kudeatzaileak lehioaren dekorazaioa mugiarazten\n(AfterStep, Enlightenment, FVWM, IceWM, Sawmill)" }, - { "iso-8859-15", "Nyt sovellukset, joiden ikkunoista on nkyvill vain otsikkopalkki" }, - { "ISO-8859-1", "Afficher les tches qui ne sont pas dans la liste des fentres" }, - { "iso-8859-1", "Nl applet ag tabhair freagra ar iarratas sbhil.\nBain amach an applet n lean ar fnacht?" }, - { "iso-8859-1", "Amosa-las tarefas agochadas da lista de fiestras (SKIP-WINLIST)" }, - { "iso-8859-2", "Az ablakkezel a dekorcit 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 neatsakinja praym isisaugoti.\nPaalinti pried ar laukti toliau?" }, - { "iso-8859-1", "Window manager verplaatst dekoratie\n(AfterStep, Enlightenment, FVWM, IceWM, Sawmill)" }, - { "iso-8859-1", "Vindushndtereren 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 responsvel por executar outras aplicaes, embeber pequenos applets, a paz no mundo e crashes aleatrios do X." }, - { "iso-8859-1", "Mostrar tarefas que se escondem da lista de janelas (SKIP-WINLIST)" }, - { "koi8-r", " " }, - { "iso-8859-2", "Sprvca okien presva okraje okien\n(AfterStep, Enlightenment, FVWM, IceWM, Sawfish)" }, - { "iso-8859-2", "Kai 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", "Fnsterhanteraren flyttar dekorationsfnstret istllet\n(AfterStep, Enlightenment, FVWM, IceWM, Sawfish)" }, - /*{ "TSCII", "츼- ¡ 츼 (츼--Ţ)" },*/ - { "iso-8859-9", "Kaydetme isteine bir uygulak cevap vermiyor .\nUygula sileyim mi , yoksa bekleyeyim mi ?" }, - { "koi8-u", "ͦ æ ͦ צ\n(AfterStep, Enlightenment, FVWM, IceWM, Sawfish)" }, - { "iso-8859-1", "Cwand on scriftr est bodj fo, li scriftr t totes\nles apliketes dvins sont pierdowes. Bodj ci scriftr 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 - -#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 - -/* 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 41622cb3ea..0000000000 --- a/camel/tests/lib/camel-test.c +++ /dev/null @@ -1,355 +0,0 @@ - -#include "camel-test.h" - -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -/* 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()) - -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; - - printf("\nThread %d:\n", id); - - 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); - - if (camel_test_verbose > 2) { - printf("Attach debugger to pid %d to debug\n", getpid()); - sleep(1000); - } - } - - _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;itest = 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 -#include - -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 5104da6c12..0000000000 --- a/camel/tests/lib/folders.c +++ /dev/null @@ -1,570 +0,0 @@ -#include - -#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; - int gettotal, getunread; - CamelMessageInfo *info; - - push("test folder counts %d total %d unread", total, unread); - - /* first, use the standard functions */ - camel_object_get(folder, NULL, CAMEL_FOLDER_TOTAL, &gettotal, CAMEL_FOLDER_UNREAD, &getunread, 0); - check(gettotal == total); - check(getunread == unread); - - /* next, use the summary */ - s = camel_folder_get_summary(folder); - check(s != NULL); - check(s->len == total); - myunread = s->len; - for (i=0;ilen;i++) { - info = s->pdata[i]; - if (camel_message_info_flags(info) & 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;ilen;i++) { - info = camel_folder_get_message_info(folder, s->pdata[i]); - if (camel_message_info_flags(info) & 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(camel_message_info_date_sent(info) == 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;ilen;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;ilen;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;ilen;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;ilen;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;indexedlen == 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, 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[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, 8); - 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, 0); - 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 (g_ascii_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 -#include -#include - -/* 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 ff3485f9c2..0000000000 --- a/camel/tests/lib/messages.c +++ /dev/null @@ -1,290 +0,0 @@ -#include -#include -#include - -#include "messages.h" -#include "camel-test.h" - -#include -#include -#include -#include - -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; -} - -static void -hexdump (const unsigned char *in, int inlen) -{ - const unsigned char *inptr = in, *start = inptr; - const unsigned char *inend = in + inlen; - int octets; - - while (inptr < inend) { - octets = 0; - while (inptr < inend && octets < 16) { - printf ("%.2X ", *inptr++); - octets++; - } - - while (octets < 16) { - printf (" "); - octets++; - } - - printf (" "); - - while (start < inptr) { - fputc (isprint ((int) *start) ? *start : '.', stdout); - start++; - } - - fputc ('\n', stdout); - } -} - -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_decode_to_stream(dw, (CamelStream *)content); - - if (content->buffer->len != len) { - printf ("original text:\n"); - hexdump (text, len); - - printf ("new text:\n"); - hexdump (content->buffer->data, content->buffer->len); - } - - 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 (CamelMimeMessage *msg) -{ - CamelMimeMessage *msg2; - CamelStreamMem *mem1, *mem2; - - mem1 = (CamelStreamMem *) camel_stream_mem_new (); - check_msg(camel_data_wrapper_write_to_stream ((CamelDataWrapper *) msg, (CamelStream *) mem1) != -1, "write_to_stream 1 failed"); - camel_stream_reset ((CamelStream *) mem1); - - msg2 = camel_mime_message_new (); - check_msg(camel_data_wrapper_construct_from_stream ((CamelDataWrapper *) msg2, (CamelStream *) mem1) != -1, "construct_from_stream 1 failed"); - camel_stream_reset ((CamelStream *) mem1); - - mem2 = (CamelStreamMem *) camel_stream_mem_new (); - check_msg(camel_data_wrapper_write_to_stream ((CamelDataWrapper *) msg2, (CamelStream *) mem2) != -1, "write_to_stream 2 failed"); - camel_stream_reset ((CamelStream *) mem2); - - if (mem1->buffer->len != mem2->buffer->len) { - CamelDataWrapper *content; - - printf ("mem1 stream:\n%.*s\n", mem1->buffer->len, mem1->buffer->data); - printf ("mem2 stream:\n%.*s\n\n", mem2->buffer->len, mem2->buffer->data); - - printf("msg1:\n"); - test_message_dump_structure(msg); - printf("msg2:\n"); - test_message_dump_structure(msg2); - - content = camel_medium_get_content_object ((CamelMedium *) msg); - } - - check_unref(msg2, 1); - - check_msg (mem1->buffer->len == mem2->buffer->len, - "mem1->buffer->len = %d, mem2->buffer->len = %d", - mem1->buffer->len, mem2->buffer->len); - - check_msg (memcmp (mem1->buffer->data, mem2->buffer->data, mem1->buffer->len) == 0, "msg/stream compare"); - - camel_object_unref (mem1); - camel_object_unref (mem2); - - return 0; -} - -int -test_message_compare_header(CamelMimeMessage *m1, CamelMimeMessage *m2) -{ - return 0; -} - -int -test_message_compare_messages(CamelMimeMessage *m1, CamelMimeMessage *m2) -{ - return 0; -} - -static void -message_dump_rec(CamelMimeMessage *msg, CamelMimePart *part, int depth) -{ - CamelDataWrapper *containee; - int parts, i; - char *s; - char *mime_type; - - s = alloca(depth+1); - memset(s, ' ', depth); - s[depth] = 0; - - mime_type = camel_data_wrapper_get_mime_type((CamelDataWrapper *)part); - printf("%sPart <%s>\n", s, ((CamelObject *)part)->klass->name); - printf("%sContent-Type: %s\n", s, mime_type); - g_free(mime_type); - printf("%s encoding: %s\n", s, camel_transfer_encoding_to_string(((CamelDataWrapper *)part)->encoding)); - printf("%s part encoding: %s\n", s, camel_transfer_encoding_to_string(part->encoding)); - - containee = camel_medium_get_content_object (CAMEL_MEDIUM (part)); - - if (containee == NULL) - return; - - mime_type = camel_data_wrapper_get_mime_type(containee); - printf("%sContent <%s>\n", s, ((CamelObject *)containee)->klass->name); - printf ("%sContent-Type: %s\n", s, mime_type); - g_free (mime_type); - printf("%s encoding: %s\n", s, camel_transfer_encoding_to_string(((CamelDataWrapper *)containee)->encoding)); - - /* using the object types is more accurate than using the mime/types */ - if (CAMEL_IS_MULTIPART (containee)) { - parts = camel_multipart_get_number (CAMEL_MULTIPART (containee)); - for (i = 0; i < parts; i++) { - CamelMimePart *part = camel_multipart_get_part (CAMEL_MULTIPART (containee), i); - - message_dump_rec(msg, part, depth+1); - } - } else if (CAMEL_IS_MIME_MESSAGE (containee)) { - message_dump_rec(msg, (CamelMimePart *)containee, depth+1); - } -} - -void -test_message_dump_structure(CamelMimeMessage *m) -{ - message_dump_rec(m, (CamelMimePart *)m, 0); -} diff --git a/camel/tests/lib/messages.h b/camel/tests/lib/messages.h deleted file mode 100644 index 24e0407af0..0000000000 --- a/camel/tests/lib/messages.h +++ /dev/null @@ -1,18 +0,0 @@ - -#include - -/* 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); -int test_message_compare (CamelMimeMessage *msg); - -void test_message_dump_structure(CamelMimeMessage *m); - -int test_message_compare_header(CamelMimeMessage *m1, CamelMimeMessage *m2); -int test_message_compare_messages(CamelMimeMessage *m1, CamelMimeMessage *m2); 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 -#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 - -#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 d62db50938..0000000000 --- a/camel/tests/lib/streams.c +++ /dev/null @@ -1,242 +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 - -#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;jparent_stream; - int i, len; - - 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; - - 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 010fdc3270..0000000000 --- a/camel/tests/message/Makefile.am +++ /dev/null @@ -1,23 +0,0 @@ - -INCLUDES = \ - -I$(includedir) \ - -I$(top_srcdir) \ - -I$(top_srcdir)/intl \ - -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)/libedataserver/libedataserver-${BASE_VERSION}.la \ - $(top_builddir)/camel/tests/lib/libcameltest.a \ - $(INTLLIBS) - -check_PROGRAMS = \ - test1 \ - test2 \ - test3 \ - test4 - -TESTS = test1 test2 test3 test4 diff --git a/camel/tests/message/README b/camel/tests/message/README deleted file mode 100644 index 4b3c953a63..0000000000 --- a/camel/tests/message/README +++ /dev/null @@ -1,9 +0,0 @@ - -test1 creating, saving, loading simple messages -test2 camelinternetaddress tests, internationalised addresses, etc. -test3 multipart messages -test4 more encompassing mime parser tests that test real-world messages. - Note: In order to test this, though, you'll need to fetch - http://primates.ximian.com/~fejj/camel-mime-tests.tar.gz and - untar it into camel/tests/data/ - diff --git a/camel/tests/message/test1.c b/camel/tests/message/test1.c deleted file mode 100644 index 8dcf84c92c..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 -#include -#include - -#include -#include -#include - -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 -#include -#include -#include -#include - -#include -#include - -#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 -#include -#include - -#include -#include -#include -#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/message/test4.c b/camel/tests/message/test4.c deleted file mode 100644 index ff3b08af30..0000000000 --- a/camel/tests/message/test4.c +++ /dev/null @@ -1,129 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * Authors: Jeffrey Stedfast - * - * Copyright 2003 Ximian, Inc. (www.ximian.com) - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Street #330, Boston, MA 02111-1307, USA. - * - */ - - -#include -#include -#include -#include -#include -#include - -#include "camel-test.h" -#include "messages.h" - -#include -#include -#include -#include - - -#if 0 -static void -dump_mime_struct (CamelMimePart *mime_part, int depth) -{ - CamelDataWrapper *content; - char *mime_type; - int i = 0; - - while (i < depth) { - printf (" "); - i++; - } - - content = camel_medium_get_content_object ((CamelMedium *) mime_part); - - mime_type = camel_data_wrapper_get_mime_type (content); - printf ("Content-Type: %s\n", mime_type); - g_free (mime_type); - - if (CAMEL_IS_MULTIPART (content)) { - guint num, index = 0; - - num = camel_multipart_get_number ((CamelMultipart *) content); - while (index < num) { - mime_part = camel_multipart_get_part ((CamelMultipart *) content, index); - dump_mime_struct (mime_part, depth + 1); - index++; - } - } else if (CAMEL_IS_MIME_MESSAGE (content)) { - dump_mime_struct ((CamelMimePart *) content, depth + 1); - } -} -#endif - -int main (int argc, char **argv) -{ - struct dirent *dent; - DIR *dir; - int fd; - - camel_test_init (argc, argv); - - camel_test_start ("Message Test Suite"); - - if (!(dir = opendir ("../data/messages"))) - return 77; - - while ((dent = readdir (dir)) != NULL) { - CamelMimeMessage *message; - CamelStream *stream; - char *filename; - struct stat st; - - if (dent->d_name[0] == '.') - continue; - - filename = g_strdup_printf ("../data/messages/%s", dent->d_name); - if (stat (filename, &st) == -1 || !S_ISREG (st.st_mode)) { - g_free (filename); - continue; - } - - if ((fd = open (filename, O_RDONLY)) == -1) { - g_free (filename); - continue; - } - - push ("testing message `%s`", filename); - g_free (filename); - - stream = camel_stream_fs_new_with_fd (fd); - message = camel_mime_message_new (); - camel_data_wrapper_construct_from_stream ((CamelDataWrapper *) message, stream); - camel_stream_reset (stream); - - /*dump_mime_struct ((CamelMimePart *) message, 0);*/ - test_message_compare (message); - - camel_object_unref (message); - camel_object_unref (stream); - - pull (); - } - - closedir (dir); - - 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 9d5d882891..0000000000 --- a/camel/tests/mime-filter/Makefile.am +++ /dev/null @@ -1,34 +0,0 @@ - -INCLUDES = \ - -I$(includedir) \ - -I$(top_srcdir) \ - -I$(top_srcdir)/intl \ - -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)/libedataserver/libedataserver-${BASE_VERSION}.la \ - $(top_builddir)/camel/tests/lib/libcameltest.a \ - $(INTLLIBS) - -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 @@ - - - - -һվʽóס漰ƹϵͳ An all-in-one solution for trading, inventory, accounting management - - - - - - - - - - - - - - - - -
-

- - - - - TRADEdotNET - -  
-
һվʽóס漰ƹϵͳܶʼ롢ݴ౨ۡƱ֡ռʡƱļЧعóס漰

-

- - - - - TRADEdotNET - -  
- What's the most annoying part during your - work? -
Endless repetitive data - entry, calculation and paper work on quotation, invoice, inventory - management, daily voucher, journal and reporting? Once you have installed - TRADEdotNET, all of these - annoying work will never appear in your office again!
- TRADEdotNET
is an all-in-one solution for trading, inventory, - accounting management. In the TRADEdotNET  - environment, all data can be continuously retrieved and reused. This will - help you for minimizing time consumed on data entry and enhancing - efficiency.

- - TRADEdotNET - ֱϵͳɣó׶ϵͳ - - TRADEdotNET - Containing Trading Management - Module, Inventory Management Module and Accounting Management Module.
-

-

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - TRADEdotNET - ŵ
-
-  ϵͳ - -
-
-

- IJͼʾϵͳҪ̣û˳ÿһ衣ûֻ밴ͼͼ񣬼ϵͳݷʽɽضĹܻ档
- - -

- - - - - TRADEdotNET - Highlights :
-
- -  Easy Access - -
-
-

- 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.

-
-  ƵIJѯѰ - -
-
-
-
- Աشͻѯ򷢳ʱ׼¼̲˷ʱ䣬һش׼ȷӴʧȥⱦĿͻѯѰֲͬʵʱѯܣܿѰݼ¼ֻҪûͻšƷšƱڵһѰѰ漴ʾ
-
- -  Perfect On-line Enquiry - -
-
-
-
- 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. -
-  ļ -
-
- ϵͳʽӿԳõĴƱΪûʱӦͬռʸʽܸЧʵشճ
- -  Input - Template -
-
- 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.
- -  ޼¼  
-
- ϵͳǿ󣬲¼ޣûʱκʱڵĽ׼¼ -
-
- - -  Unlimited - Data Record  
-
- The system can store unlimited number of - records, so that users can retrieve data of any time whenever they need - it.
-  ϵͳ -
-
-
- Ƚĵϵͳ()ֻȨûģϵͳԱӦûְ趨ûȨޡ
- -  Login Control -
-
-
- 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.
-  ѡʽ -
-
-
- ϵͳԿʽƣֻҪSeagate Crystal Report ()Ʊʽӱ
- -  Customize Report -
-
-
- 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.
- -  Ѕn
-
-
-
- 80%ıMS Excel/WordʽҪͼݷ֮á
- MS Excel/WordȸʽԵʸ͸йԱ
- -  Multi-Report Export Tools
-
-
-
- Over 80% of reports can be exported to MS - Excel /  Word and data can be translated into graphs and tables for - further analysis.
- Reports can also be export to MS Excel / Word format independently or send - to email client with attachment directly.
-  ʻ֧ -
-
-
-
- Ϊϲó׹˾ڹڻ賧ֹ˾Ҫݻͨ
TRADEdotNET - - ṩȫ氲ȫƽ̨װ TRADEdotNET ָ֧͸ûʱ԰װ - TRADEdotNET - - ı׼ MS ϵͳʹá
- -  Internet Ready -
-
-
-
- To facilitate data exchange between trading companies and their offices in - the Mainland China or Southeast Asia Country,
- - Install and makes use of TRADEdotNET - Internet Kit  to provide a secured platform enabling user - to access the data from different locations anytime through the internet - with TRADEdotNET - - system.
-  ݿ֧ -
-
-
-
- ΪϲͬС˾ıҪ
TRADEdotNET ṩͬݿ汾ԹѡƳ MS AccessMS SQLƳ Oracle ݿ⡣
-
- -  Multi-Database Format -
-
-
-
-
TRADEdotNET - - 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.
-  ֹ֧ -
-
-
- ֶ֧ûֶ֧๫˾ֶ֧ңֶ֧棬ֶ֧(/Ӣ) -
- -  Multiple Functionality -
-
-
- Support multi-users, multi-companies, - multi-currencies, multi-inventory, multi-languages (Chinese / English).
- - -  ϵͳҪ - -
-

- ̨
- Intel Pentium II () Processor PC
- Windows 98, ME, 2000 Windows NT 4.0
- 64 MB RAMƼ128MB
- 256ɫ֮SVGAʾ
- 50MBӲ̿ռ
- Windows 98, ME, 2000 Windows NT 4.0 ֧֮ӡ
- - - -  System - Requirements - - -
-

- - Workstation
- Intel Pentium II (or above) Processor PC
- Windows 98, ME, 2000 or Windows NT 4.0
- 64MB RAM - minimum 128MB - recommended
- 256 color SVGA display or higher
- 50MB free Hard Disk
- Printers - supported by - Windows 98, ME, 2000 Windows NT 4.0
-
- -  Χ - -
-
- ϵͳʾ
-      ϵͳʾ -
-
- ϵͳװ
-      ϵͳװɱ˾רҵʦ -
-
- ݱݼԭ
-      Ϊͻ趨ݱݼԭťϿͻ֮豸
-
- ļʽ
-      Ϊͻļʽ߹˾()
-
- ϵͳִ
-      Ϊ趨ϵͳ̱ŵִ -
-
- ûѵ
-      ûѵڿͻ칫ңҲ޴ -
-
- ϵͳѯ
-      ṩЧֱӵѯ񣬴ϵͳ -
-
- ϵͳ
-      ѱ -
-      ڱΪͻϵͳ -
- -  Services - Provided - -
-
- System Demonstration
-      Free-of-charge system demonstration in client's office
-
- System Installation
-      - On-site - installation - by our - professional - engineers
-
- Backup/Restore
-      Setups of backup and restore icons associated with client's backup device (e.g. Zip Drive, MO)
-
- Tailored Format
-      Tailored designs on document formats to highlight and promote company image
-
- System Implementation
-      - Implementation - procedures - customized for - each - organization
-
- User Training
-      Unlimited training is provided in the client's office -
-
- Hot-line Enquiry
-      Efficient hot-line support for all system enquiries
-
- System Maintenance
-      Half-a-year free maintenance
-      Free - upgrade - services - throughout - warranty - periods
-
-
- - - - -
-
- ӭ Ԥ Լ ʾ   : (852) 2591 9377

Ѷ - ˾  Superdata International Ltd.
- Tel: (852) 2591 9377

-

- - - *All prices, - conditions and - system - specifications - are subject to - change without - prior notice. - м۸漰ϵͳ֮޸ģ֪ͨ - -

- - 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 @@ - - - - -一站式的贸易、库存及会计管理系统 An all-in-one solution for trading, inventory, accounting management - - - - - - - - - - - - - - - - -
-

- - - - - TRADEdotNET - -  
-
是一站式的贸易、库存及会计管理系统,助您精简周而复始的资料输入、数据处理及各类报价、发票、存仓、日记帐、传票、报表等所需的文件行政工作,让您更有效地管理贸易、库存及会计事务。

-

- - - - - TRADEdotNET - -  
- What's the most annoying part during your - work? -
Endless repetitive data - entry, calculation and paper work on quotation, invoice, inventory - management, daily voucher, journal and reporting? Once you have installed - TRADEdotNET, all of these - annoying work will never appear in your office again!
- TRADEdotNET
is an all-in-one solution for trading, inventory, - accounting management. In the TRADEdotNET  - environment, all data can be continuously retrieved and reused. This will - help you for minimizing time consumed on data entry and enhancing - efficiency.

- - TRADEdotNET - 分别由组系统组成:贸易订单管理、库存管理及会计系统 - - TRADEdotNET - Containing Trading Management - Module, Inventory Management Module and Accounting Management Module.
-

-

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - TRADEdotNET - 的优点
-
-  简易系统登入 - -
-
-

- 简单易明的操作流程图显示整个系统的主要流程,引导用户顺利完成每一个步骤。用户只须按下流程图的图像,即系统快捷方式,便可进入特定的功能画面。
- - -

- - - - - TRADEdotNET - Highlights :
-
- -  Easy Access - -
-
-

- 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.

-
-  完善的查询搜寻器 - -
-
-
-
- 当员工回答客户查询或发出订单,经常需时翻查以往交易纪录,这个过程不仅浪费时间,万一回答不准确,更可能令您从此失去这宝贵的客户。查询搜寻器多种不同的实时查询功能,能快速搜寻所需的数据纪录,只要用户输入客户编号、货品编号、发票日期等其中一项搜寻参数,搜寻结果随即显示。
-
- -  Perfect On-line Enquiry - -
-
-
-
- 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. -
-  文件输入 -
-
- 系统的总帐接口设计以常用的传票为蓝本,用户无需费时重新适应不同日记帐格式,而且能更有效率地处理日常会计帐项数据输入程序。
- -  Input - Template -
-
- 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.
- -  无限纪录储存  
-
- 系统容量强大,不设纪录储存年期上限,因此用户可以随时查阅任何时期的交易纪录。 -
-
- - -  Unlimited - Data Record  
-
- The system can store unlimited number of - records, so that users can retrieve data of any time whenever they need - it.
-  系统登入监控 -
-
-
- 先进的登入监控系统保障(机密)数据只供授权用户查阅,系统管理员亦可以因应用户的职级而设定个别用户的阅览权限。
- -  Login Control -
-
-
- 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.
-  自选报表格式 -
-
-
- 系统报表以开放式设计,只需要配合Seagate Crystal Report (另购),即可自行设计报表格式或增加报表。
- -  Customize Report -
-
-
- 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.
- -  多向列n报表工具
-
-
-
- 超过80%的报表可以MS Excel/Word格式输出,按需要而制作图表供数据分析之用。
- 报表可以MS Excel/Word等格式独立输出或以电邮附带传送给有关人员。
- -  Multi-Report Export Tools
-
-
-
- Over 80% of reports can be exported to MS - Excel /  Word and data can be translated into graphs and tables for - further analysis.
- Reports can also be export to MS Excel / Word format independently or send - to email client with attachment directly.
-  国际互联支持 -
-
-
-
- 为了配合不少贸易公司于国内或东南亚设厂或分公司而需要数据数据互通,
TRADEdotNET - - 提供全面安全的整合平台,安装 TRADEdotNET 互联网支持附件,透过互联网,用户即可随时随地以安装了 - TRADEdotNET - - 的标准 MS 操作系统登入使用。
- -  Internet Ready -
-
-
-
- To facilitate data exchange between trading companies and their offices in - the Mainland China or Southeast Asia Country,
- - Install and makes use of TRADEdotNET - Internet Kit  to provide a secured platform enabling user - to access the data from different locations anytime through the internet - with TRADEdotNET - - system.
-  多种数据库支持 -
-
-
-
- 为了配合不同大小公司的本身需要,
TRADEdotNET 提供不同数据库版本以供选择。已推出有 MS Access、MS SQL,即将推出有 Oracle 及其它数据库。
-  
- -  Multi-Database Format -
-
-
-
-
TRADEdotNET - - 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.
-  其它支持功能 -
-
-
- 支持多用户,支持多公司,支持多货币,支持多库存,支持多语言(中文/英文) -
- -  Multiple Functionality -
-
-
- Support multi-users, multi-companies, - multi-currencies, multi-inventory, multi-languages (Chinese / English).
- - -  系统要求 - -
-

- 工作台
- Intel Pentium II (或以上) Processor PC
- Windows 98, ME, 2000 或 Windows NT 4.0
- 最少用 64 MB RAM,推荐用128MB
- 256色或以上之SVGA显示器
- 50MB硬盘空间
- Windows 98, ME, 2000 或 Windows NT 4.0 支持之打印机
- - - -  System - Requirements - - -
-

- - Workstation
- Intel Pentium II (or above) Processor PC
- Windows 98, ME, 2000 or Windows NT 4.0
- 64MB RAM - minimum, 128MB - recommended
- 256 color SVGA display or higher
- 50MB free Hard Disk
- Printers - supported by - Windows 98, ME, 2000 或 Windows NT 4.0
-  
- -  服务范围 - -
-
- 系统示范
-      免费上门作系统示范 - 。
-
- 系统安装
-      系统安装会由本公司专业工程师负责 - 。
-
- 数据备份及还原
-      免费为客户设定数据备份及还原按钮,以配合客户之‘备份设备’。
-
- 度身订做文件式样
-      为客户度身订做文件式样,提高公司形象(另费)。
-
- 系统执行
-      为各机构设定系统流程表及监察各部门的执行情况 - 。
-
- 用户培训
-      用户培训可设在客户办公室,而且不限次数 - 。
-
- 系统咨询热线
-      提供有效直接的热线咨询服务,处理系统疑难 - 。
-
- 系统保养
-      半年免费保养 - ;
-      于保养期内免费为客户作系统提升 - 。
- -  Services - Provided - -
-
- System Demonstration
-      Free-of-charge system demonstration in client's office
-
- System Installation
-      - On-site - installation - by our - professional - engineers
-
- Backup/Restore
-      Setups of backup and restore icons associated with client's backup device (e.g. Zip Drive, MO)
-
- Tailored Format
-      Tailored designs on document formats to highlight and promote company image
-
- System Implementation
-      - Implementation - procedures - customized for - each - organization
-
- User Training
-      Unlimited training is provided in the client's office -
-
- Hot-line Enquiry
-      Efficient hot-line support for all system enquiries
-
- System Maintenance
-      Half-a-year free maintenance
-      Free - upgrade - services - throughout - warranty - periods
-
-
- - - - -
-
- 欢 迎 预 约 示 范 请电 : (852) 2591 9377

精 讯 国 际 有 - 限 公 司  Superdata International Ltd.
- Tel: (852) 2591 9377

-

- - - *All prices, - conditions and - system - specifications - are subject to - change without - prior notice. - 所有价格,条规及系统规格之修改,将不另行通知。 - - 

- - 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 @@ -えろいtyうとうぃういえyてrちうえryとyrとえつお3945098094えいr -とえつおえうとえるとうt - -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: - - - 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: - - <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.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: - - - \ 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: - - <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/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 -#include -#include -#include - -#include "camel-test.h" - -#include -#include -#include -#include - -#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 -#include - -#include "camel-test.h" - -#include -#include -#include -#include - -#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 -#include - -#include -#include -#include -#include - -#include "camel-test.h" - -#include -#include -#include -#include - -#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 1be915e3f0..0000000000 --- a/camel/tests/misc/Makefile.am +++ /dev/null @@ -1,28 +0,0 @@ - -INCLUDES = \ - -I$(includedir) \ - -I$(top_srcdir) \ - -I$(top_srcdir)/intl \ - -I$(top_srcdir)/camel \ - -I$(top_srcdir)/camel/tests/lib \ - -DG_LOG_DOMAIN=\"evolution-tests\" \ - $(CAMEL_CFLAGS) - -LDADD = \ - $(top_builddir)/camel/libcamel-provider.la \ - $(top_builddir)/camel/libcamel.la \ - $(top_builddir)/libedataserver/libedataserver-${BASE_VERSION}.la \ - $(top_builddir)/camel/tests/lib/libcameltest.a \ - $(INTLLIBS) - -check_PROGRAMS = \ - url \ - url-scan \ - utf7 \ - split \ - test2 - -TESTS = url utf7 split url-scan test2 - - - diff --git a/camel/tests/misc/README b/camel/tests/misc/README deleted file mode 100644 index 6b8f4a22f2..0000000000 --- a/camel/tests/misc/README +++ /dev/null @@ -1,5 +0,0 @@ - -test2 rfc2184 multipart/i18n parameters -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 4fa8d18ea9..0000000000 --- a/camel/tests/misc/split.c +++ /dev/null @@ -1,113 +0,0 @@ -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -#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; ilen == split_tests[i].count, "words->len = %d, count = %d", words->len, split_tests[i].count); - - for (j=0;jlen;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; ilen == simple_tests[i].count, "words->len = %d, count = %d", words->len, simple_tests[i].count); - - for (j=0;jlen;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/test2.c b/camel/tests/misc/test2.c deleted file mode 100644 index a802392e91..0000000000 --- a/camel/tests/misc/test2.c +++ /dev/null @@ -1,121 +0,0 @@ - - -#include - -#include -#include -#include -#include -#include -#include - -#include "camel-test.h" - -/* NB: We know which order the params will be decoded in, plain in the order they come, - and rfc2184 encoded following those, sorted lexigraphically */ -struct { - char *list; - int count; - char *params[8]; -} test1[] = { - { "; charset=\"iso-8859-1\"", - 1, - { "charset", "iso-8859-1" }, }, - { "; charset=iso-8859-1", - 1, - { "charset", "iso-8859-1" }, }, - { "; charset=\"iso-8859-1\"; boundary=\"foo\"", - 2, - { "charset", "iso-8859-1", - "boundary", "foo" }, }, - { "; charset*1 = 8859; charset*0=\"iso-8859-1'en'iso-\";charset*2=\"-1\" ", - 1, - { "charset", "iso-8859-1" }, }, - { "; charset*1 = 8859; boundary=foo; charset*0=\"iso-8859-1'en'iso-\";charset*2=\"-1\" ", - 2, - { "boundary", "foo", - "charset", "iso-8859-1", }, }, - { "; charset*1 = 8859; boundary*0=f; charset*0=\"iso-8859-1'en'iso-\"; boundary*2=\"o\" ; charset*2=\"-1\"; boundary*1=o ", - 2, - { "boundary", "foo", - "charset", "iso-8859-1", }, }, - { "; charset*1 = 8859; boundary*0=\"iso-8859-1'en'f\"; charset*0=\"iso-8859-1'en'iso-\"; boundary*2=\"o\" ; charset*2=\"-1\"; boundary*1=o ", - 2, - { "boundary", "foo", - "charset", "iso-8859-1", }, }, -}; - -struct { - int count; - char *params[8]; - char *list; -} test2[] = { - { 1, - { "name", "Doul\xC3\xADk01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123457890123456789123456789" }, - ";\n" - "\tname*0*=iso-8859-1''Doul%EDk012345678901234567890123456789012345678901234;\n" - "\tname*1*=56789012345678901234567890123456789012345678901234567890123457890;\n" - "\tname*2*=123456789123456789" }, - { 1, - { "name", "\"%$#@ special chars?;; !" }, - "; name=\"\\\"%$#@ special chars?;; !\"" }, - { 1, - { "name", "\"%$#@ special chars?;; !\xC3\xAD" }, - "; name*=iso-8859-1''%22%25$#%40%20special%20chars%3F%3B%3B%20!%ED" }, -}; - -int -main (int argc, char **argv) -{ - int i, j; - - camel_test_init(argc, argv); - - camel_test_start("Param list decoding"); - - for (i=0;iname, test1[i].params[j*2]) == 0); - check(strcmp(node->value, test1[i].params[j*2+1]) == 0); - node = node->next; - } - check_msg(node == NULL, "found more params than should have"); - camel_header_param_list_free(head); - camel_test_pull(); - } - - camel_test_end(); - - camel_test_start("Param list encoding"); - - for (i=0;inext; - check(j == test2[i].count); - - text = camel_header_param_list_format(head); - check(strcmp(text, test2[i].list) == 0); - camel_header_param_list_free(head); - - camel_test_pull(); - } - - camel_test_end(); - - return 0; -} diff --git a/camel/tests/misc/url-scan.c b/camel/tests/misc/url-scan.c deleted file mode 100644 index a7bbf51cf5..0000000000 --- a/camel/tests/misc/url-scan.c +++ /dev/null @@ -1,132 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * Authors: Jeffrey Stedfast - * - * Copyright 2004 Ximian, Inc. (www.ximian.com) - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Street #330, Boston, MA 02111-1307, USA. - * - */ - - -#ifdef HAVE_CONFIG_H -#include -#endif - -#include -#include -#include - -#include - -#include "camel-test.h" - -struct { - char *text, *url; -} url_tests[] = { - { "bob@foo.com", "mailto:bob@foo.com" }, - { "Ends with bob@foo.com", "mailto:bob@foo.com" }, - { "bob@foo.com at start", "mailto:bob@foo.com" }, - { "bob@foo.com.", "mailto:bob@foo.com" }, - { "\"bob@foo.com\"", "mailto:bob@foo.com" }, - { "", "mailto:bob@foo.com" }, - { "(bob@foo.com)", "mailto:bob@foo.com" }, - { "bob@foo.com, 555-9999", "mailto:bob@foo.com" }, - { "|bob@foo.com|555-9999|", "mailto:bob@foo.com" }, - { "bob@ no match bob@", NULL }, - { "@foo.com no match @foo.com", NULL }, - { "\"bob\"@foo.com", NULL }, - { "M@ke money fast!", NULL }, - { "ASCII art @_@ @>->-", NULL }, - - { "http://www.foo.com", "http://www.foo.com" }, - { "Ends with http://www.foo.com", "http://www.foo.com" }, - { "http://www.foo.com at start", "http://www.foo.com" }, - { "http://www.foo.com.", "http://www.foo.com" }, - { "http://www.foo.com/.", "http://www.foo.com/" }, - { "", "http://www.foo.com" }, - { "(http://www.foo.com)", "http://www.foo.com" }, - { "http://www.foo.com, 555-9999", "http://www.foo.com" }, - { "|http://www.foo.com|555-9999|", "http://www.foo.com" }, - { "foo http://www.foo.com/ bar", "http://www.foo.com/" }, - { "foo http://www.foo.com/index.html bar", "http://www.foo.com/index.html" }, - { "foo http://www.foo.com/q?99 bar", "http://www.foo.com/q?99" }, - { "foo http://www.foo.com/;foo=bar&baz=quux bar", "http://www.foo.com/;foo=bar&baz=quux" }, - { "foo http://www.foo.com/index.html#anchor bar", "http://www.foo.com/index.html#anchor" }, - { "http://www.foo.com/index.html; foo", "http://www.foo.com/index.html" }, - { "http://www.foo.com/index.html: foo", "http://www.foo.com/index.html" }, - { "http://www.foo.com/index.html-- foo", "http://www.foo.com/index.html" }, - { "http://www.foo.com/index.html?", "http://www.foo.com/index.html" }, - { "http://www.foo.com/index.html!", "http://www.foo.com/index.html" }, - { "\"http://www.foo.com/index.html\"", "http://www.foo.com/index.html" }, - { "'http://www.foo.com/index.html'", "http://www.foo.com/index.html" }, - { "http://bob@www.foo.com/bar/baz/", "http://bob@www.foo.com/bar/baz/" }, - { "http no match http", NULL }, - { "http: no match http:", NULL }, - { "http:// no match http://", NULL }, - { "unrecognized://bob@foo.com/path", "mailto:bob@foo.com" }, - - { "src/www.c", NULL }, - { "Ewwwwww.Gross.", NULL }, - -}; - -static int num_url_tests = G_N_ELEMENTS (url_tests); - -int main (int argc, char **argv) -{ - char *html, *url, *p; - int i, errors = 0; - guint32 flags; - - camel_test_init (argc, argv); - - camel_test_start ("URL scanning"); - - flags = CAMEL_MIME_FILTER_TOHTML_CONVERT_URLS | CAMEL_MIME_FILTER_TOHTML_CONVERT_ADDRESSES; - for (i = 0; i < num_url_tests; i++) { - camel_test_push ("'%s' => '%s'", url_tests[i].text, url_tests[i].url ? url_tests[i].url : "None"); - - html = camel_text_to_html (url_tests[i].text, flags, 0); - - url = strstr (html, "href=\""); - if (url) { - url += 6; - p = strchr (url, '"'); - if (p) - *p = '\0'; - - while ((p = strstr (url, "&"))) - memmove (p + 1, p + 5, strlen (p + 5) + 1); - } - - if ((url && (!url_tests[i].url || strcmp (url, url_tests[i].url) != 0)) || - (!url && url_tests[i].url)) { - printf ("FAILED on \"%s\" -> %s\n (got %s)\n\n", - url_tests[i].text, - url_tests[i].url ? url_tests[i].url : "(nothing)", - url ? url : "(nothing)"); - errors++; - } - - g_free (html); - } - - printf ("\n%d errors\n", errors); - - camel_test_end (); - - return errors; -} 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 - -#include -#include -#include -#include -#include -#include - -#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 - -#include -#include -#include -#include -#include -#include -#include - -#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; iutf8", 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 edd4314500..0000000000 --- a/camel/tests/smime/Makefile.am +++ /dev/null @@ -1,23 +0,0 @@ - -INCLUDES = \ - -I$(includedir) \ - -I$(top_srcdir) \ - -I$(top_srcdir)/intl \ - -I$(top_srcdir)/camel \ - -I$(top_srcdir)/camel/tests/lib \ - -DG_LOG_DOMAIN=\"evolution-tests\" \ - $(CAMEL_CFLAGS) - -LDADD = \ - $(top_builddir)/libedataserver/libedataserver-${BASE_VERSION}.la \ - $(top_builddir)/camel/tests/lib/libcameltest.a \ - $(top_builddir)/camel/libcamel-provider.la \ - $(top_builddir)/camel/libcamel.la \ - $(INTLLIBS) - -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 2ec805b4a4..0000000000 --- a/camel/tests/smime/pgp-mime.c +++ /dev/null @@ -1,214 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * Authors: Jeffrey Stedfast - * - * Copyright 2003 Ximian, Inc. (www.ximian.com) - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Street #330, Boston, MA 02111-1307, USA. - * - */ - - -#ifdef HAVE_CONFIG_H -#include -#endif - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#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: Draen Kaar\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, - guint32 flags, - 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, guint32 flags, - CamelService *service, const char *item, CamelException *ex) -{ - return g_strdup ("no.secret"); -} - -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; - int ret; - - camel_test_init (argc, argv); - - /* clear out any camel-test data */ - system ("/bin/rm -rf /tmp/camel-test"); - system ("/bin/mkdir /tmp/camel-test"); - setenv ("GNUPGHOME", "/tmp/camel-test/.gnupg", 1); - - /* import the gpg keys */ - if ((ret = system ("gpg < /dev/null > /dev/null 2>&1")) == -1) - return 77; - else if (WEXITSTATUS (ret) == 127) - return 77; - - system ("gpg --import ../data/camel-test.gpg.pub > /dev/null 2>&1"); - system ("gpg --import ../data/camel-test.gpg.sec > /dev/null 2>&1"); - - session = camel_pgp_session_new ("/tmp/camel-test"); - - ex = camel_exception_new (); - - ctx = camel_gpg_context_new (session); - 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, "no.user@no.domain", 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, "no.user@no.domain"); - - mpe = camel_multipart_encrypted_new (); - camel_multipart_encrypted_encrypt (mpe, mime_part, ctx, "no.user@no.domain", 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 851a9dcca4..0000000000 --- a/camel/tests/smime/pgp.c +++ /dev/null @@ -1,250 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * Authors: Jeffrey Stedfast - * - * Copyright 2003 Ximian, Inc. (www.ximian.com) - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Street #330, Boston, MA 02111-1307, USA. - * - */ - - -#ifdef HAVE_CONFIG_H -#include -#endif - -#include -#include -#include -#include -#include -#include -#include - -#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, - guint32 flags, - 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, guint32 flags, - CamelService *service, const char *item, CamelException *ex) -{ - return g_strdup ("no.secret"); -} - -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; - struct _CamelMimePart *sigpart, *conpart, *encpart, *outpart; - CamelDataWrapper *dw; - GPtrArray *recipients; - GByteArray *buf; - char *before, *after; - int ret; - - camel_test_init (argc, argv); - - /* clear out any camel-test data */ - system ("/bin/rm -rf /tmp/camel-test"); - system ("/bin/mkdir /tmp/camel-test"); - setenv ("GNUPGHOME", "/tmp/camel-test/.gnupg", 1); - - /* import the gpg keys */ - if ((ret = system ("gpg < /dev/null > /dev/null 2>&1")) == -1) - return 77; - else if (WEXITSTATUS (ret) == 127) - return 77; - - system ("gpg --import ../data/camel-test.gpg.pub > /dev/null 2>&1"); - system ("gpg --import ../data/camel-test.gpg.sec > /dev/null 2>&1"); - - session = camel_pgp_session_new ("/tmp/camel-test"); - - ex = camel_exception_new (); - - ctx = camel_gpg_context_new (session); - 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); - - conpart = camel_mime_part_new(); - dw = camel_data_wrapper_new(); - camel_data_wrapper_construct_from_stream(dw, stream1); - camel_medium_set_content_object((CamelMedium *)conpart, dw); - camel_object_unref(stream1); - camel_object_unref(dw); - - sigpart = camel_mime_part_new(); - - camel_test_push ("PGP signing"); - camel_cipher_sign (ctx, "no.user@no.domain", CAMEL_CIPHER_HASH_SHA1, conpart, sigpart, ex); - if (camel_exception_is_set(ex)) { - printf("PGP signing failed assuming non-functional environment\n%s", camel_exception_get_description (ex)); - camel_test_pull(); - return 77; - } - camel_test_pull (); - - camel_exception_clear (ex); - - camel_test_push ("PGP verify"); - valid = camel_cipher_verify (ctx, sigpart, 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(conpart); - camel_object_unref(sigpart); - - stream1 = camel_stream_mem_new (); - camel_stream_write (stream1, "Hello, I am a test of encryption/decryption.", 44); - camel_stream_reset (stream1); - - conpart = camel_mime_part_new(); - dw = camel_data_wrapper_new(); - camel_stream_reset(stream1); - camel_data_wrapper_construct_from_stream(dw, stream1); - camel_medium_set_content_object((CamelMedium *)conpart, dw); - camel_object_unref(stream1); - camel_object_unref(dw); - - encpart = camel_mime_part_new(); - - camel_exception_clear (ex); - - camel_test_push ("PGP encrypt"); - recipients = g_ptr_array_new (); - g_ptr_array_add (recipients, "no.user@no.domain"); - camel_cipher_encrypt (ctx, "no.user@no.domain", recipients, conpart, encpart, 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_test_push ("PGP decrypt"); - outpart = camel_mime_part_new(); - valid = camel_cipher_decrypt (ctx, encpart, outpart, ex); - check_msg (!camel_exception_is_set (ex), "%s", camel_exception_get_description (ex)); - check_msg (valid->encrypt.status == CAMEL_CIPHER_VALIDITY_ENCRYPT_ENCRYPTED, "%s", valid->encrypt.description); - - stream1 = camel_stream_mem_new(); - stream2 = camel_stream_mem_new(); - - camel_data_wrapper_write_to_stream((CamelDataWrapper *)conpart, stream1); - camel_data_wrapper_write_to_stream((CamelDataWrapper *)outpart, stream2); - - buf = CAMEL_STREAM_MEM (stream1)->buffer; - before = g_strndup (buf->data, buf->len); - buf = CAMEL_STREAM_MEM (stream2)->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_object_unref(stream1); - camel_object_unref(stream2); - camel_object_unref(conpart); - camel_object_unref(encpart); - camel_object_unref(outpart); - - 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 baedd36c8c..0000000000 --- a/camel/tests/smime/pkcs7.c +++ /dev/null @@ -1,178 +0,0 @@ -#include - -#include -#include -#include -#include -#include - -#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, - guint32 flags, 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, guint32 flags, - 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 114e02e0a0..0000000000 --- a/camel/tests/stream/Makefile.am +++ /dev/null @@ -1,23 +0,0 @@ - -INCLUDES = \ - -I$(includedir) \ - -I$(top_srcdir) \ - -I$(top_srcdir)/intl \ - -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)/libedataserver/libedataserver-${BASE_VERSION}.la \ - $(top_builddir)/camel/tests/lib/libcameltest.a \ - $(INTLLIBS) - -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 -#include -#include - -#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 -#include -#include - -#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 -#include -#include - -#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