Mercurial > thymian
comparison 3rdparty/vmime/tests/parser/messageIdTest.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 | |
| 27 VMIME_TEST_SUITE_BEGIN(messageIdTest) | |
| 28 | |
| 29 VMIME_TEST_LIST_BEGIN | |
| 30 VMIME_TEST(testParse) | |
| 31 VMIME_TEST(testParseInvalid) | |
| 32 VMIME_TEST(testGenerate) | |
| 33 VMIME_TEST_LIST_END | |
| 34 | |
| 35 | |
| 36 void testParse() | |
| 37 { | |
| 38 vmime::messageId m1; | |
| 39 m1.parse("<a@b>"); | |
| 40 | |
| 41 VASSERT_EQ("1.1", "a", m1.getLeft()); | |
| 42 VASSERT_EQ("1.2", "b", m1.getRight()); | |
| 43 } | |
| 44 | |
| 45 void testParseInvalid() | |
| 46 { | |
| 47 vmime::messageId m1; | |
| 48 m1.parse("foo@bar"); | |
| 49 | |
| 50 VASSERT_EQ("1.1", "foo", m1.getLeft()); | |
| 51 VASSERT_EQ("1.2", "bar", m1.getRight()); | |
| 52 } | |
| 53 | |
| 54 void testGenerate() | |
| 55 { | |
| 56 vmime::messageId m1; | |
| 57 | |
| 58 VASSERT_EQ("1", "<>", m1.generate()); | |
| 59 | |
| 60 vmime::messageId m2; | |
| 61 m2.setLeft("a"); | |
| 62 | |
| 63 VASSERT_EQ("2", "<a>", m2.generate()); | |
| 64 | |
| 65 vmime::messageId m3; | |
| 66 m3.setRight("b"); | |
| 67 | |
| 68 VASSERT_EQ("3", "<@b>", m3.generate()); | |
| 69 | |
| 70 vmime::messageId m4; | |
| 71 m4.setLeft("a"); | |
| 72 m4.setRight("b"); | |
| 73 | |
| 74 VASSERT_EQ("4", "<a@b>", m4.generate()); | |
| 75 } | |
| 76 | |
| 77 VMIME_TEST_SUITE_END | |
| 78 |
