diff options
Diffstat (limited to 'tests/mailbox')
-rw-r--r-- | tests/mailbox/Makefile | 4 | ||||
-rw-r--r-- | tests/mailbox/main.cpp | 119 | ||||
-rwxr-xr-x | tests/mailbox/run-test.sh | 37 | ||||
-rw-r--r-- | tests/mailbox/test-suites/test1.in | 1 | ||||
-rw-r--r-- | tests/mailbox/test-suites/test1.out | 1 | ||||
-rw-r--r-- | tests/mailbox/test-suites/test2.in | 1 | ||||
-rw-r--r-- | tests/mailbox/test-suites/test2.out | 8 |
7 files changed, 0 insertions, 171 deletions
diff --git a/tests/mailbox/Makefile b/tests/mailbox/Makefile deleted file mode 100644 index 97e76b4d..00000000 --- a/tests/mailbox/Makefile +++ /dev/null @@ -1,4 +0,0 @@ - -main: main.cpp ../../libvmime-debug.a - g++ -g -o main main.cpp ../../libvmime-debug.a - diff --git a/tests/mailbox/main.cpp b/tests/mailbox/main.cpp deleted file mode 100644 index cd59d900..00000000 --- a/tests/mailbox/main.cpp +++ /dev/null @@ -1,119 +0,0 @@ -// -// VMime library (http://vmime.sourceforge.net) -// Copyright (C) 2002-2004 Vincent Richard <[email protected]> -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License as -// published by the Free Software Foundation; either version 2 of -// the License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -// - -#include <iostream> -#include <ostream> -#include <sstream> -#include <string> -#include <fstream> - -#include "../../src/vmime" -#include "../../examples/common.inc" - - - -std::ostream& operator<<(std::ostream& os, const vmime::text& txt) -{ - os << "["; - - for (int i = 0 ; i < txt.getWordCount() ; ++i) - { - const vmime::word& w = *txt.getWordAt(i); - - if (i != 0) - os << ","; - - os << "[" << w.getCharset().getName() << "," << w.getBuffer() << "]"; - } - - os << "]"; - - return (os); -} - - -std::ostream& operator<<(std::ostream& os, const vmime::mailbox& mbox) -{ - std::cout << "MAILBOX[name=" << mbox.getName() << ",email=" << mbox.getEmail() << "]" << std::endl; - - return (os); -} - - -std::ostream& operator<<(std::ostream& os, const vmime::mailboxGroup& group) -{ - std::cout << "GROUP[name=" << group.getName() << "]" << std::endl; - - for (int i = 0 ; i < group.getMailboxCount() ; ++i) - { - std::cout << "* " << *group.getMailboxAt(i); - } - - return (os); -} - - -int main(int argc, char* argv[]) -{ - // VMime initialization - vmime::platformDependant::setHandler<my_handler>(); - - - // Read data from standard input - std::ostringstream data; - std::istream* input = &std::cin; - std::ifstream file; - - if (argc >= 2) - { - file.open(argv[1], std::ios::in | std::ios::binary); - input = &file; - } - - while (!input->eof()) - { - char buffer[4096]; - input->read(buffer, sizeof(buffer)); - data.write(buffer, input->gcount()); - } - - // Parse address list and output results - vmime::addressList list; - list.parse(data.str()); - - for (int i = 0 ; i < list.getAddressCount() ; ++i) - { - const vmime::address& addr = *list.getAddressAt(i); - - if (addr.isGroup()) - { - const vmime::mailboxGroup& group = - dynamic_cast <const vmime::mailboxGroup&>(addr); - - std::cout << group; - } - else - { - const vmime::mailbox& mbox = - dynamic_cast <const vmime::mailbox&>(addr); - - std::cout << mbox; - } - } -} diff --git a/tests/mailbox/run-test.sh b/tests/mailbox/run-test.sh deleted file mode 100755 index 7f5fbb2b..00000000 --- a/tests/mailbox/run-test.sh +++ /dev/null @@ -1,37 +0,0 @@ -#!/bin/sh - -TEST_DIR="./test-suites" -TEMP_DIR="/tmp" -PROGRAM="./main" - - -testFiles=`cd $TEST_DIR ; ls *.in` - -echo -echo Testing address parsing -echo ===================================================================== - -for testFile in $testFiles ; do - - testName=`echo $testFile | sed 's/\([^\.]*\)\.in/\1/'` - - printf %20s "$testName : " - - $PROGRAM < $TEST_DIR/$testFile > $TEMP_DIR/vmime_result - - diff="diff $TEMP_DIR/vmime_result $TEST_DIR/$testName.out" - res=`$diff` - - if [ "$res" = "" ] - then - echo "[OK]" - else - diffFile=$TEMP_DIR/vmime.mailbox.$testName.diff - echo "[NO: diff file is $diffFile]" - $diff > $diffFile - fi - -done - -echo - diff --git a/tests/mailbox/test-suites/test1.in b/tests/mailbox/test-suites/test1.in deleted file mode 100644 index 961feed7..00000000 --- a/tests/mailbox/test-suites/test1.in +++ /dev/null @@ -1 +0,0 @@ -My (this is a comment)name <me(another \)comment) @ somewhere(else).com> diff --git a/tests/mailbox/test-suites/test1.out b/tests/mailbox/test-suites/test1.out deleted file mode 100644 index 8f969f49..00000000 --- a/tests/mailbox/test-suites/test1.out +++ /dev/null @@ -1 +0,0 @@ -MAILBOX[name=[[us-ascii,My name]],[email protected]] diff --git a/tests/mailbox/test-suites/test2.in b/tests/mailbox/test-suites/test2.in deleted file mode 100644 index 4b2c6284..00000000 --- a/tests/mailbox/test-suites/test2.in +++ /dev/null @@ -1 +0,0 @@ -mailbox1 <mailbox@one>,;,,, ,, ,,;group1:mailbox1@group1, mailbox2@group2,,"mailbox #3" <mailbox3@group2>;, <mailbox@two>,,,,,,,,=?iso-8859-1?q?mailbox_number_3?= <mailbox@three>, =?abc?Q?mailbox?= =?def?Q?_number_4?= <mailbox@four> diff --git a/tests/mailbox/test-suites/test2.out b/tests/mailbox/test-suites/test2.out deleted file mode 100644 index 527b4baf..00000000 --- a/tests/mailbox/test-suites/test2.out +++ /dev/null @@ -1,8 +0,0 @@ -MAILBOX[name=[[us-ascii,mailbox1]],email=mailbox@one] -GROUP[name=[[us-ascii,group1]]] -* MAILBOX[name=[],email=mailbox1@group1] -* MAILBOX[name=[],email=mailbox2@group2] -* MAILBOX[name=[[us-ascii,mailbox #3]],email=mailbox3@group2] -MAILBOX[name=[],email=mailbox@two] -MAILBOX[name=[[iso-8859-1,mailbox number 3]],email=mailbox@three] -MAILBOX[name=[[abc,mailbox],[def, number 4]],email=mailbox@four] |