comparison 3rdparty/vmime/tests/parser/emptyContentHandlerTest.cpp @ 0:a4671277546c tip

created the repository for the thymian project
author ferencd
date Tue, 17 Aug 2021 11:19:54 +0200
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:a4671277546c
1 //
2 // VMime library (http://www.vmime.org)
3 // Copyright (C) 2002-2013 Vincent Richard <vincent@vmime.org>
4 //
5 // This program is free software; you can redistribute it and/or
6 // modify it under the terms of the GNU General Public License as
7 // published by the Free Software Foundation; either version 3 of
8 // the License, or (at your option) any later version.
9 //
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 // General Public License for more details.
14 //
15 // You should have received a copy of the GNU General Public License along
16 // with this program; if not, write to the Free Software Foundation, Inc.,
17 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 //
19 // Linking this library statically or dynamically with other modules is making
20 // a combined work based on this library. Thus, the terms and conditions of
21 // the GNU General Public License cover the whole combination.
22 //
23
24 #include "tests/testUtils.hpp"
25
26 #include "vmime/utility/outputStreamAdapter.hpp"
27
28
29 VMIME_TEST_SUITE_BEGIN(emptyContentHandlerTest)
30
31 VMIME_TEST_LIST_BEGIN
32 VMIME_TEST(testIsEmpty)
33 VMIME_TEST(testGetLength)
34 VMIME_TEST(testIsEncoded)
35 VMIME_TEST(testExtract)
36 VMIME_TEST(testExtractRaw)
37 VMIME_TEST(testGenerate)
38 VMIME_TEST_LIST_END
39
40
41 void testIsEmpty()
42 {
43 vmime::emptyContentHandler cth;
44
45 VASSERT_TRUE("empty", cth.isEmpty());
46 }
47
48 void testGetLength()
49 {
50 vmime::emptyContentHandler cth;
51
52 VASSERT_EQ("length", 0, cth.getLength());
53 }
54
55 void testIsEncoded()
56 {
57 vmime::emptyContentHandler cth;
58
59 VASSERT_FALSE("encoded", cth.isEncoded());
60 VASSERT_EQ("encoding", vmime::contentHandler::NO_ENCODING, cth.getEncoding());
61 }
62
63 void testExtract()
64 {
65 vmime::emptyContentHandler cth;
66
67 std::ostringstream oss;
68 vmime::utility::outputStreamAdapter osa(oss);
69
70 cth.extract(osa);
71
72 VASSERT_EQ("extract", "", oss.str());
73 }
74
75 void testExtractRaw()
76 {
77 vmime::emptyContentHandler cth;
78
79 std::ostringstream oss;
80 vmime::utility::outputStreamAdapter osa(oss);
81
82 cth.extractRaw(osa);
83
84 VASSERT_EQ("extractRaw", "", oss.str());
85 }
86
87 void testGenerate()
88 {
89 vmime::emptyContentHandler cth;
90
91 std::ostringstream oss;
92 vmime::utility::outputStreamAdapter osa(oss);
93
94 cth.generate(osa, vmime::encoding("base64"));
95
96 VASSERT_EQ("generate", "", oss.str());
97 }
98
99 VMIME_TEST_SUITE_END