aboutsummaryrefslogtreecommitdiffstats
path: root/tests/parser/headerTest.cpp
diff options
context:
space:
mode:
authorLaurent Richard <[email protected]>2004-10-21 15:38:15 +0000
committerLaurent Richard <[email protected]>2004-10-21 15:38:15 +0000
commit5a13156740e8c07e71f865e8ba02f8bf49982b5f (patch)
tree776d8d690c8c168aab2a63f0aecd596921034010 /tests/parser/headerTest.cpp
parentRefactoring (see ChangeLog). (diff)
downloadvmime-5a13156740e8c07e71f865e8ba02f8bf49982b5f.tar.gz
vmime-5a13156740e8c07e71f865e8ba02f8bf49982b5f.zip
Added tests for hasField() and findField() functions.
Diffstat (limited to 'tests/parser/headerTest.cpp')
-rw-r--r--tests/parser/headerTest.cpp38
1 files changed, 38 insertions, 0 deletions
diff --git a/tests/parser/headerTest.cpp b/tests/parser/headerTest.cpp
index 13a8f03e..60684ee6 100644
--- a/tests/parser/headerTest.cpp
+++ b/tests/parser/headerTest.cpp
@@ -21,6 +21,38 @@ namespace
return (oss.str());
}
+ // has function tests
+ void testHas1()
+ {
+ vmime::header hdr;
+ hdr.parse("From: x\r\nTo: y\r\nTo: z\r\n");
+
+ bool res = hdr.hasField("Z");
+
+ assert_eq("Value", false, res);
+ }
+
+ void testHas2()
+ {
+ vmime::header hdr;
+ hdr.parse("X: x\r\nTo: y\r\nTo: z\r\n");
+
+ bool res = hdr.hasField("To");
+
+ assert_eq("Value", true, res);
+ }
+
+ // find function tests
+ void testFind1()
+ {
+ vmime::header hdr;
+ hdr.parse("A: a\r\nB: b\r\nC: c\r\nB: d\r\n");
+
+ vmime::headerField* res = hdr.findField("B");
+
+ assert_eq("Value", "B: b", getFieldValue(*res));
+ }
+
// getAllByName function tests
void testFindAllFields1()
{
@@ -64,9 +96,15 @@ namespace
// VMime initialization
vmime::platformDependant::setHandler<my_handler>();
+ add("Has", testcase(this, "Has1", &headerTest::testHas1));
+ add("Has", testcase(this, "Has2", &headerTest::testHas2));
+
+ add("Find", testcase(this, "Find1", &headerTest::testFind1));
+
add("FindAllFields", testcase(this, "FindAllFields1", &headerTest::testFindAllFields1));
add("FindAllFields", testcase(this, "FindAllFields2", &headerTest::testFindAllFields2));
add("FindAllFields", testcase(this, "FindAllFields3", &headerTest::testFindAllFields3));
+
suite::main().add("vmime::header", this);
}