blob: 30aece7728bf84d0ffac1c1e3757228a5cd2beeb (
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
// vim: syntax=cpp
/*
* Copyright (C) 2007-2023 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/blob.h"
#include "bu/blobbuilder.h"
#include "bu/exceptionindexoutofbounds.h"
#include "bu/sio.h"
#include <string.h>
suite BlobBuilder
{
test append
{
Bu::BlobBuilder a;
a.append("a");
a.append("bc");
a += "def";
a.append("abcdef");
}
test appendChar
{
Bu::BlobBuilder a;
for( int j = 0; j < 20; j++ )
{
a += 'A';
}
unitTest( a.getBlob() == "AAAAAAAAAAAAAAAAAAAA" );
}
test operators1
{
Bu::BlobBuilder a;
a << "Hello" << " " << Bu::Blob("there") << " how are you?";
unitTest( a.getBlob() == "Hello there how are you?" );
}
test operators2
{
Bu::BlobBuilder a;
a += "Hello";
a += " ";
a += Bu::Blob("there");
a += " how are you?";
unitTest( a.getBlob() == "Hello there how are you?" );
}
}
|