aboutsummaryrefslogtreecommitdiff
path: root/src/unit
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2011-07-17 21:59:43 +0000
committerMike Buland <eichlan@xagasoft.com>2011-07-17 21:59:43 +0000
commit0ac83365291af6260a45730bd24a0c0d98d9d8fd (patch)
tree6ad8b9bf67fc7e8953aecdd313714cf7fae35c59 /src/unit
parent0bc7562c218376b44a3eb87db0e310df0b1d0036 (diff)
downloadlibbu++-0ac83365291af6260a45730bd24a0c0d98d9d8fd.tar.gz
libbu++-0ac83365291af6260a45730bd24a0c0d98d9d8fd.tar.bz2
libbu++-0ac83365291af6260a45730bd24a0c0d98d9d8fd.tar.xz
libbu++-0ac83365291af6260a45730bd24a0c0d98d9d8fd.zip
More variant unit tests, signed and unsigned chars are no formatted as numbers,
while chars are formatted as characters.
Diffstat (limited to 'src/unit')
-rw-r--r--src/unit/variant.unit27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/unit/variant.unit b/src/unit/variant.unit
index 1654c4f..4fd5e26 100644
--- a/src/unit/variant.unit
+++ b/src/unit/variant.unit
@@ -10,6 +10,18 @@
10#include "bu/membuf.h" 10#include "bu/membuf.h"
11#include "bu/formatter.h" 11#include "bu/formatter.h"
12#include "bu/string.h" 12#include "bu/string.h"
13#include "bu/sio.h"
14
15using namespace Bu;
16
17Bu::String mkastring()
18{
19 Bu::String a = "s";
20 a += "tu";
21 a += "f";
22 a += "f";
23 return a;
24}
13 25
14suite Variant 26suite Variant
15{ 27{
@@ -29,6 +41,21 @@ suite Variant
29 Bu::Formatter f( mb ); 41 Bu::Formatter f( mb );
30 f << v; 42 f << v;
31 unitTest( mb.getString() == v.get<Bu::String>() ); 43 unitTest( mb.getString() == v.get<Bu::String>() );
44 }
32 45
46 test stringForamtting
47 {
48 Bu::String s1;
49 s1 = "hello";
50 int32_t i1, i2;
51 i1 = 32;
52 i2 = 0;
53 Bu::String out = Bu::String("%1-%2-%3-%4.odp").
54 arg( s1.getStr() ).
55 arg( mkastring().getStr() ).
56 arg( i1, Fmt(2).fill('0') ).
57 arg( i2, Fmt(2).fill('0') );
58 sio << sio.nl << out << sio.nl;
59 unitTest( out == "hello-stuff-32-00.odp" );
33 } 60 }
34} 61}