summaryrefslogtreecommitdiff
path: root/src/unit/base64.unit
blob: 9706c852e5c2248ebd3b0b6555efe17cb253db65 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
// vim: syntax=cpp
/*
 * Copyright (C) 2007-2014 Xagasoft, All rights reserved.
 *
 * This file is part of the libbu++ library and is released under the
 * terms of the license contained in the file LICENSE.
 */

#include "bu/strfilter.h"
#include "bu/base64.h"

suite MemBuf
{
    test decode01
    {
        unitTest( Bu::decodeStr<Bu::Base64>("RnVu") == "Fun" );
        unitTest( Bu::decodeStr<Bu::Base64>("V2hhdA==") == "What" );
        unitTest( Bu::decodeStr<Bu::Base64>("SGVsbG8=") == "Hello" );
    }

    test encode01
    {
        unitTest( Bu::decodeStr<Bu::Base64>("R n V  u") == "Fun" );
        unitTest( Bu::decodeStr<Bu::Base64>("V2\n\n\thh   dA==") == "What" );
        unitTest( Bu::decodeStr<Bu::Base64>("\n\n\t\t   SGV\r\ns\tbG8\n=") == "Hello" );
    }
}