summaryrefslogtreecommitdiff
path: root/src/unit/variant.unit
diff options
context:
space:
mode:
Diffstat (limited to 'src/unit/variant.unit')
-rw-r--r--src/unit/variant.unit70
1 files changed, 35 insertions, 35 deletions
diff --git a/src/unit/variant.unit b/src/unit/variant.unit
index 684bea1..68c7be5 100644
--- a/src/unit/variant.unit
+++ b/src/unit/variant.unit
@@ -16,46 +16,46 @@ using namespace Bu;
16 16
17Bu::String mkastring() 17Bu::String mkastring()
18{ 18{
19 Bu::String a = "s"; 19 Bu::String a = "s";
20 a += "tu"; 20 a += "tu";
21 a += "f"; 21 a += "f";
22 a += "f"; 22 a += "f";
23 return a; 23 return a;
24} 24}
25 25
26suite Variant 26suite Variant
27{ 27{
28 test construction 28 test construction
29 { 29 {
30 Bu::Variant v( 55 ); 30 Bu::Variant v( 55 );
31 v.get<int>(); 31 v.get<int>();
32 32
33 Bu::Variant v2( v ); 33 Bu::Variant v2( v );
34 v2.get<int>(); 34 v2.get<int>();
35 } 35 }
36 36
37 test formatting 37 test formatting
38 { 38 {
39 Bu::Variant v("hello"); 39 Bu::Variant v("hello");
40 Bu::MemBuf mb; 40 Bu::MemBuf mb;
41 Bu::Formatter f( mb ); 41 Bu::Formatter f( mb );
42 f << v; 42 f << v;
43 unitTest( mb.getString() == v.get<Bu::String>() ); 43 unitTest( mb.getString() == v.get<Bu::String>() );
44 } 44 }
45 45
46 test stringForamtting 46 test stringForamtting
47 { 47 {
48 Bu::String s1; 48 Bu::String s1;
49 s1 = "hello"; 49 s1 = "hello";
50 int32_t i1, i2; 50 int32_t i1, i2;
51 i1 = 32; 51 i1 = 32;
52 i2 = 0; 52 i2 = 0;
53 Bu::String out = Bu::String("%1-%2-%3-%4.odp"). 53 Bu::String out = Bu::String("%1-%2-%3-%4.odp").
54 arg( s1.getStr() ). 54 arg( s1.getStr() ).
55 arg( mkastring().getStr() ). 55 arg( mkastring().getStr() ).
56 arg( i1, Fmt(2).fill('0') ). 56 arg( i1, Fmt(2).fill('0') ).
57 arg( i2, Fmt(2).fill('0') ); 57 arg( i2, Fmt(2).fill('0') );
58 // sio << sio.nl << out << sio.nl; 58 // sio << sio.nl << out << sio.nl;
59 unitTest( out == "hello-stuff-32-00.odp" ); 59 unitTest( out == "hello-stuff-32-00.odp" );
60 } 60 }
61} 61}