aboutsummaryrefslogtreecommitdiffstats
path: root/camel/tests/mime-filter
diff options
context:
space:
mode:
Diffstat (limited to 'camel/tests/mime-filter')
-rw-r--r--camel/tests/mime-filter/.cvsignore8
-rw-r--r--camel/tests/mime-filter/Makefile.am39
-rw-r--r--camel/tests/mime-filter/crlf-1.in19
-rw-r--r--camel/tests/mime-filter/crlf-1.out19
-rw-r--r--camel/tests/mime-filter/stripheader-1.in6
-rw-r--r--camel/tests/mime-filter/stripheader-1.out5
-rw-r--r--camel/tests/mime-filter/stripheader-2.in8
-rw-r--r--camel/tests/mime-filter/stripheader-2.out6
-rw-r--r--camel/tests/mime-filter/stripheader-3.in9
-rw-r--r--camel/tests/mime-filter/stripheader-3.out7
-rw-r--r--camel/tests/mime-filter/stripheader-4.in7
-rw-r--r--camel/tests/mime-filter/stripheader-4.out5
-rw-r--r--camel/tests/mime-filter/stripheader-5.in9
-rw-r--r--camel/tests/mime-filter/stripheader-5.out5
-rw-r--r--camel/tests/mime-filter/stripheader-6.in15
-rw-r--r--camel/tests/mime-filter/stripheader-6.out6
-rw-r--r--camel/tests/mime-filter/test-crlf.c163
-rw-r--r--camel/tests/mime-filter/test-stripheader.c131
18 files changed, 0 insertions, 467 deletions
diff --git a/camel/tests/mime-filter/.cvsignore b/camel/tests/mime-filter/.cvsignore
deleted file mode 100644
index c1f16ee7d4..0000000000
--- a/camel/tests/mime-filter/.cvsignore
+++ /dev/null
@@ -1,8 +0,0 @@
-.deps
-Makefile
-Makefile.in
-.libs
-*.lo
-*.la
-test-stripheader
-test-crlf
diff --git a/camel/tests/mime-filter/Makefile.am b/camel/tests/mime-filter/Makefile.am
deleted file mode 100644
index 5d85ecd7df..0000000000
--- a/camel/tests/mime-filter/Makefile.am
+++ /dev/null
@@ -1,39 +0,0 @@
-
-INCLUDES = -I$(top_srcdir)/intl -I$(top_srcdir) -I$(top_srcdir)/camel \
- -I$(includedir) \
- -I$(top_srcdir)/camel/tests/lib \
- -DG_LOG_DOMAIN=\"evolution-tests\" \
- -DSOURCEDIR=\"$(srcdir)\"
-
-LDADD = \
- $(top_builddir)/camel/libcamel.la \
- $(top_builddir)/e-util/libeutil.la \
- $(top_builddir)/libibex/libibex.la \
- $(GNOME_LIBDIR) \
- $(top_builddir)/camel/tests/lib/libcameltest.a \
- $(GNOMEUI_LIBS) $(INTLLIBS) $(MAILER_LIBS)
-
-EXTRA_DIST = \
- crlf-1.in \
- crlf-1.out \
- stripheader-1.in \
- stripheader-1.out \
- stripheader-2.in \
- stripheader-2.out \
- stripheader-3.in \
- stripheader-3.out \
- stripheader-4.in \
- stripheader-4.out \
- stripheader-5.in \
- stripheader-5.out \
- stripheader-6.in \
- stripheader-6.out
-
-check_PROGRAMS = \
- test-crlf \
- test-stripheader
-
-TESTS = test-crlf test-stripheader
-
-
-
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/stripheader-1.in b/camel/tests/mime-filter/stripheader-1.in
deleted file mode 100644
index 1db4bf86e3..0000000000
--- a/camel/tests/mime-filter/stripheader-1.in
+++ /dev/null
@@ -1,6 +0,0 @@
-Subject: this is a simple test
-Stripped: of the header stripping filter
-CC: this header should be preserved
-BCC: as should this one
-
-This is the body of the message. \ No newline at end of file
diff --git a/camel/tests/mime-filter/stripheader-1.out b/camel/tests/mime-filter/stripheader-1.out
deleted file mode 100644
index 3101c1e6bd..0000000000
--- a/camel/tests/mime-filter/stripheader-1.out
+++ /dev/null
@@ -1,5 +0,0 @@
-Subject: this is a simple test
-CC: this header should be preserved
-BCC: as should this one
-
-This is the body of the message. \ No newline at end of file
diff --git a/camel/tests/mime-filter/stripheader-2.in b/camel/tests/mime-filter/stripheader-2.in
deleted file mode 100644
index 0a16133bc0..0000000000
--- a/camel/tests/mime-filter/stripheader-2.in
+++ /dev/null
@@ -1,8 +0,0 @@
-Subject: this is a simple test
-Stripped: of the header stripping filter
-CC: this header should be preserved
-Stripped: this header should also be stripped
-BCC: but not this one
-
-This is the body of the message.
-There are several lines to it. Oh boy oh boy. \ No newline at end of file
diff --git a/camel/tests/mime-filter/stripheader-2.out b/camel/tests/mime-filter/stripheader-2.out
deleted file mode 100644
index 626dd9c170..0000000000
--- a/camel/tests/mime-filter/stripheader-2.out
+++ /dev/null
@@ -1,6 +0,0 @@
-Subject: this is a simple test
-CC: this header should be preserved
-BCC: but not this one
-
-This is the body of the message.
-There are several lines to it. Oh boy oh boy. \ No newline at end of file
diff --git a/camel/tests/mime-filter/stripheader-3.in b/camel/tests/mime-filter/stripheader-3.in
deleted file mode 100644
index d7c348125b..0000000000
--- a/camel/tests/mime-filter/stripheader-3.in
+++ /dev/null
@@ -1,9 +0,0 @@
-Subject: this is a simple test with a different subject
-Stripped: of the header stripping filter
-Stripped: this header should also be stripped
-CC: this header should be preserved
-BCC: and so should this one
-
-This is the body of the message.
-There are several lines to it. Oh boy oh boy.
-Let's add lots of characters on this line just for fun because I love fun don't you who wouldn't love fun I sure do. \ No newline at end of file
diff --git a/camel/tests/mime-filter/stripheader-3.out b/camel/tests/mime-filter/stripheader-3.out
deleted file mode 100644
index a6da94594e..0000000000
--- a/camel/tests/mime-filter/stripheader-3.out
+++ /dev/null
@@ -1,7 +0,0 @@
-Subject: this is a simple test with a different subject
-CC: this header should be preserved
-BCC: and so should this one
-
-This is the body of the message.
-There are several lines to it. Oh boy oh boy.
-Let's add lots of characters on this line just for fun because I love fun don't you who wouldn't love fun I sure do. \ No newline at end of file
diff --git a/camel/tests/mime-filter/stripheader-4.in b/camel/tests/mime-filter/stripheader-4.in
deleted file mode 100644
index 5b0b12e080..0000000000
--- a/camel/tests/mime-filter/stripheader-4.in
+++ /dev/null
@@ -1,7 +0,0 @@
-Subject: this is a simple test
-Stripped: of the header stripping filter
- ooh look this header spans two lines.
-CC: this header should be preserved
-BCC: as should this one
-
-This is the body of the message. \ No newline at end of file
diff --git a/camel/tests/mime-filter/stripheader-4.out b/camel/tests/mime-filter/stripheader-4.out
deleted file mode 100644
index 3101c1e6bd..0000000000
--- a/camel/tests/mime-filter/stripheader-4.out
+++ /dev/null
@@ -1,5 +0,0 @@
-Subject: this is a simple test
-CC: this header should be preserved
-BCC: as should this one
-
-This is the body of the message. \ No newline at end of file
diff --git a/camel/tests/mime-filter/stripheader-5.in b/camel/tests/mime-filter/stripheader-5.in
deleted file mode 100644
index 99258daec6..0000000000
--- a/camel/tests/mime-filter/stripheader-5.in
+++ /dev/null
@@ -1,9 +0,0 @@
-Subject: this is a simple test
-Stripped: of the header stripping filter
- ooh look this header spans many
- lines look at all the freaking lines
- that this header spans. Wowwww.
-CC: this header should be preserved
-BCC: as should this one
-
-This is the body of the message. \ No newline at end of file
diff --git a/camel/tests/mime-filter/stripheader-5.out b/camel/tests/mime-filter/stripheader-5.out
deleted file mode 100644
index 3101c1e6bd..0000000000
--- a/camel/tests/mime-filter/stripheader-5.out
+++ /dev/null
@@ -1,5 +0,0 @@
-Subject: this is a simple test
-CC: this header should be preserved
-BCC: as should this one
-
-This is the body of the message. \ No newline at end of file
diff --git a/camel/tests/mime-filter/stripheader-6.in b/camel/tests/mime-filter/stripheader-6.in
deleted file mode 100644
index 8bf0e848d0..0000000000
--- a/camel/tests/mime-filter/stripheader-6.in
+++ /dev/null
@@ -1,15 +0,0 @@
-Subject: this is a simple test
-Stripped: of the header stripping filter
- ooh look this header spans many
- lines look at all the freaking lines
- that this header spans. Wowwww.
-Stripped: and then another one to strip that extends fairly far across the page
-Other: let's not use CC here.
-Stripped: oops, I stripped it again
-Stripped: then single line....
- followed by multi-line. Huzzah.
-NotBCC: definitely not BCC
- however this one is definitely continued
-Stripped: god-damn look at that stripping.
-
-This is the body of the message. \ No newline at end of file
diff --git a/camel/tests/mime-filter/stripheader-6.out b/camel/tests/mime-filter/stripheader-6.out
deleted file mode 100644
index d8d4202ed0..0000000000
--- a/camel/tests/mime-filter/stripheader-6.out
+++ /dev/null
@@ -1,6 +0,0 @@
-Subject: this is a simple test
-Other: let's not use CC here.
-NotBCC: definitely not BCC
- however this one is definitely continued
-
-This is the body of the message. \ No newline at end of file
diff --git a/camel/tests/mime-filter/test-crlf.c b/camel/tests/mime-filter/test-crlf.c
deleted file mode 100644
index 2e8a4333fa..0000000000
--- a/camel/tests/mime-filter/test-crlf.c
+++ /dev/null
@@ -1,163 +0,0 @@
-/*
- test-crlf.c
-
- Test the CamelMimeFilterCrlf class
-*/
-
-#include <stdio.h>
-#include <string.h>
-
-#include "camel-test.h"
-
-#include <camel/camel-stream-fs.h>
-#include <camel/camel-stream-mem.h>
-#include <camel/camel-stream-filter.h>
-#include <camel/camel-mime-filter-crlf.h>
-
-#define d(x) x
-
-#define NUM_CASES 1
-#define CHUNK_SIZE 32
-
-enum {
- CRLF_ENCODE,
- CRLF_DECODE,
- CRLF_DONE
-};
-
-int
-main (int argc, char **argv)
-{
- CamelStream *source;
- CamelStream *correct;
- CamelStreamFilter *filter;
- CamelMimeFilter *sh;
- gchar *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, *outfile;
-
- 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;
- }
-
- d(printf ("\n\nCORRECT: >>%.*s<<", comp_correct_chunk, comp_correct));
- d(printf ("\nFILTER : >>%.*s<<\n", comp_filter_chunk, comp_filter));
-
- 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-stripheader.c b/camel/tests/mime-filter/test-stripheader.c
deleted file mode 100644
index ff5446635b..0000000000
--- a/camel/tests/mime-filter/test-stripheader.c
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- test-stripheader.c
-
- Test the CamelMimeFilterStripHeader class
-*/
-
-#include <stdio.h>
-#include <string.h>
-
-#include "camel-test.h"
-
-#include <camel/camel-stream-fs.h>
-#include <camel/camel-stream-mem.h>
-#include <camel/camel-stream-filter.h>
-#include <camel/camel-mime-filter-stripheader.h>
-
-#define d(x) x
-
-#define NUM_CASES 6
-#define CHUNK_SIZE 32
-
-int
-main(int argc, char **argv)
-{
- CamelStream *source;
- CamelStream *correct;
- CamelStreamFilter *filter;
- CamelMimeFilter *sh;
- gchar *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++) {
- work = g_strdup_printf ("Header stripping filter, test case %d", i);
- camel_test_start (work);
- g_free (work);
-
- camel_test_push ("Initializing objects");
- work = g_strdup_printf ("%s/stripheader-%d.in", SOURCEDIR, i + 1);
- source = camel_stream_fs_new_with_name (work, 0, O_RDONLY);
- if (!source) {
- camel_test_fail ("Failed to open input case in \"%s\"", work);
- g_free (work);
- continue;
- }
- g_free (work);
-
- work = g_strdup_printf ("%s/stripheader-%d.out", SOURCEDIR, i + 1);
- correct = camel_stream_fs_new_with_name (work, 0, O_RDONLY);
- if (!correct) {
- camel_test_fail ("Failed to open correct output in \"%s\"", work);
- g_free (work);
- continue;
- }
- g_free (work);
-
- filter = camel_stream_filter_new_with_stream (CAMEL_STREAM (source));
- if (!filter) {
- camel_test_fail ("Couldn't create CamelStreamFilter??");
- continue;
- }
-
- sh = camel_mime_filter_stripheader_new ("Stripped");
- if (!sh) {
- camel_test_fail ("Couldn't create CamelMimeFilterStripHeader??");
- 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;
- }
-
- d(printf ("\n\nCORRECT: >>%.*s<<", comp_correct_chunk, comp_correct);)
- d(printf ("\nFILTER : >>%.*s<<\n", comp_filter_chunk, comp_filter);)
-
- 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_end();
- }
-
- return 0;
-}