~ubuntu-branches/ubuntu/natty/mimetic/natty

« back to all changes in this revision

Viewing changes to test/t.mimemessage.h

  • Committer: Bazaar Package Importer
  • Author(s): gregor herrmann
  • Date: 2006-06-16 13:16:07 UTC
  • Revision ID: james.westby@ubuntu.com-20060616131607-245mqjypkjuahq6b
Tags: upstream-0.9.1
ImportĀ upstreamĀ versionĀ 0.9.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#ifndef _T_MIME_H_
 
2
#define _T_MIME_H_
 
3
#include <fstream>
 
4
#include <string>
 
5
#include <cstdlib>
 
6
#include <mimetic/mimetic.h>
 
7
#include "cutee.h"
 
8
 
 
9
 
 
10
namespace mimetic
 
11
{
 
12
 
 
13
class TEST_CLASS( test_mime )
 
14
{
 
15
    std::ofstream m_out;
 
16
public:
 
17
#define    SEP "................................................\n"
 
18
    test_mime()
 
19
    : m_out("tests.out")
 
20
    {
 
21
    }
 
22
    void TEST_FUNCTION( testMimeEntityBuild )
 
23
    {
 
24
        MimeEntity mm;
 
25
 
 
26
        mm.header().from("stefano@codesink.org");
 
27
        mm.header().to("you@home.net");
 
28
        mm.header().subject("Hi!");
 
29
 
 
30
        mm.body().assign("Hi!\n\nThank you for trying mimetic!");
 
31
        TEST_ASSERT_EQUALS_P(mm.size(), 96);
 
32
        m_out << std::endl << SEP << mm << std::endl;
 
33
    }
 
34
    void TEST_FUNCTION( testMimeBinaryQpAttach )
 
35
    {
 
36
        MimeEntity me;
 
37
        QP::Encoder qp;
 
38
        me.body().load("file.bin", qp);
 
39
        TEST_ASSERT_EQUALS_P(me.size(), 50650);
 
40
        m_out << std::endl << SEP << me << std::endl;
 
41
    }
 
42
    void TEST_FUNCTION( testMimeBinaryQpBinaryAttach )
 
43
    {
 
44
        MimeEntity me;
 
45
        QP::Encoder qp(true);
 
46
        me.body().load("file.bin", qp);
 
47
        TEST_ASSERT_EQUALS_P(me.size(), 50650);
 
48
        m_out << std::endl << SEP << me << std::endl;
 
49
    }
 
50
    void TEST_FUNCTION( testMimeBinaryBase64Attach )
 
51
    {
 
52
        MimeEntity me;
 
53
        Base64::Encoder b64;
 
54
        me.body().load("file.bin", b64);
 
55
        TEST_ASSERT_EQUALS_P(me.size(), 30631);
 
56
        m_out << std::endl << SEP << me << std::endl;
 
57
    }
 
58
    void TEST_FUNCTION( testMimeMessageRfc822 )
 
59
    {
 
60
        MimeEntity mm;
 
61
        mm.header().from("stefano@codesink.org");
 
62
        mm.header().to("you@home.net");
 
63
        mm.header().subject("Hi!");
 
64
        mm.body().assign("Hi!\n\nThank you for trying mimetic!");
 
65
 
 
66
        MessageRfc822 mr(mm);
 
67
        TEST_ASSERT_EQUALS_P(mr.size(), 126);
 
68
        m_out << std::endl << SEP << mr << std::endl;
 
69
    }
 
70
};
 
71
 
 
72
};
 
73
 
 
74
#endif
 
75