Change Section to debug for libmimetic0-dbg.
[debian/mimetic.git] / test / t.qp.cxx
1 #include "t.qp.h"
2 using namespace mimetic;
3
4
5 /*
6  * test field:
7  * input        output in text mode        output in binary mode
8  *
9  * note: maxlen == 12 during the following tests
10  */
11 const char* test_qp::test[][3] = {
12 { "test",         "test",                0 },
13 { "te st",         "te st",            "te=20st" },
14 { " test",         " test",            "=20test" },
15 { "\ttest",         "\ttest",            "=09test" },
16 { "tes\tt",         "tes\tt",            "tes=09t" },
17 { "equal=",         "equal=3D",            0 },
18 { "Fantastic",         "Fantastic",            0 },
19 { "Fromage",         "Fromage",            0 },
20 { "From ",         "=46rom=20",            0 },
21 { "From more",         "=46rom more",            "=46rom=20mo=\nre" },
22 { "From age",         "=46rom age",            "=46rom=20age" },
23 { "te\xfest",         "te=FEst",            0 },
24 { "te\1st",         "te=01st",            0 },
25 { ".test",         ".test",            0 },
26 { ".",             "=2E",                0 },
27 // unsafe chars
28 { "unsafe!#$",         "unsafe=21=\n=23=24",        0 },
29 // maxline test
30 { "aaaabbbbcccc",     "aaaabbbbcccc",            0 },
31 { "aaaabbbbccccd",     "aaaabbbbccc=\ncd",        0 },
32 { "aaaabbbbccccdddd",     "aaaabbbbccc=\ncdddd",    0 },
33 { "aaaabbbbcc##",     "aaaabbbbcc=\n=23=23",    0 },
34 { "aaaabbbbccc##",     "aaaabbbbccc=\n=23=23",    0 },
35 { "aaaabbbbcccc##",     "aaaabbbbccc=\nc=23=23",    0 },
36 // trailing blank (sp && tab)
37 { "abcde    f",     "abcde    f",        "abcde=20=20=\n=20=20f" },
38 { "abcde    ",      "abcde   =20",        "abcde=20=20=\n=20=20" },
39 { "Abcde     ",     "Abcde    =20",        "Abcde=20=20=\n=20=20=20" },
40 { "ABcde      ",     "ABcde     =\n=20",    "ABcde=20=20=\n=20=20=20=20"},
41 { "abcde\t \t a",     "abcde\t \t a",        "abcde=09=20=\n=09=20a" },
42 // newline testing
43 { "abcde\nf",     "abcde\nf",        "abcde=0Af" },
44 { "abcdef\n\ng",     "abcdef\n\ng",    "abcdef=0A=\n=0Ag" },
45 { "\nabc\n\ndefgh","\nabc\n\ndefgh","=0Aabc=0A=\n=0Adefgh" },
46 //
47 { 0, 0, 0 }
48 };
49
50
51 /*
52  * expected decoded string    malformed encoded string
53  */
54 const char* test_qp::test_decode_malformed[][2] = {
55 // trailing spaces
56 {"abcdefghilmnopqrst",    "abcdefghilm= \r\nnopqrst"},
57 {"abcdefghilmnopqrst",    "abcdefghilm=  \r\nnopqrst"},
58 {"abcdefghilmnopqrst",    "abcdefghilm=   \r\nnopqrst"},
59 {"abcdefghilmnopqrst",    "abcdefghilm=    \r\nnopqrst"},
60 {"abcdefghilm=     X\nnopqrst","abcdefghilm=     X\r\nnopqrst"},
61 // rfc2045 6.7 note 1
62 {"ab=cde","ab=3dcde"},
63 {"ab\xfe cde","ab=fE cde"},
64 // rfc2045 6.7 note 2
65 {"abcdefgh=ilmnopqrst","abcdefgh=ilmno=\r\npqrst"},
66 {"abcd=Xefghilmnopqrst","abcd=Xefghi=\r\nlmnopqrst"},
67 {"abcd= efghilmnopqrst","abcd= efghi=\r\nlmnopqrst"},
68 {"abcdefghilm=nopqrst",    "abcdefghilm=\r\n=nopqrst"},
69 // rfc2045 6.7 note 3
70 {"abcd=","abcd="},
71 {"abcd=A","abcd=A"},
72 {"abcd=X","abcd=X"},
73 // rfc2045 6.7 note 4
74 {"abcde","ab\1cde"},
75 {"abcde","ab\2c\3de"},
76 {"abcdefghi","\4abcd\5efghi"},
77 // rfc2045 6.7 note 4 (max line == 12)
78 {"abcdefghilmnopqrstuvz","abcdefghilmnopqrstuvz"},
79 {0,0}
80 };
81
82
83
84