6 #include <mimetic/codec/codec.h>
12 class TEST_CLASS( test_base64 )
14 static const char* test[][2];
16 void TEST_FUNCTION( testEncode )
19 while(test[i][1] != 0)
21 std::string src = test[i][0];
22 std::string exp = test[i][1];
24 Base64::Encoder base64;
25 //base64.m_maxlen = 12;
26 encode(src.begin(), src.end(),base64, std::back_inserter<std::string>(got));
27 TEST_ASSERT_EQUALS_P(exp, got);
31 void TEST_FUNCTION( testEncodeBlock )
34 while(test[i][1] != 0)
36 std::string src = test[i][0];
37 std::string exp = test[i][1];
39 Base64::Encoder base64;
40 //base64.m_maxlen = 12;
41 base64.process(src.begin(), src.end(), std::back_inserter<std::string>(got));
42 TEST_ASSERT_EQUALS_P( exp, got);
46 void TEST_FUNCTION( testDecode )
49 while(test[i][1] != 0)
51 std::string src = test[i][1];
52 std::string exp = test[i][0];
54 Base64::Decoder base64;
55 decode(src.begin(), src.end(),base64,std::back_inserter<std::string>(got));
56 TEST_ASSERT_EQUALS_P( exp, got);
60 void TEST_FUNCTION( testDecodeBlock )
63 while(test[i][1] != 0)
65 std::string src = test[i][1];
66 std::string exp = test[i][0];
68 Base64::Decoder base64;
69 base64.process(src.begin(), src.end(),std::back_inserter<std::string>(got));
70 TEST_ASSERT_EQUALS_P( exp, got);