aboutsummaryrefslogtreecommitdiff
path: root/src/unit/fstring.cpp
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2008-09-24 03:45:46 +0000
committerMike Buland <eichlan@xagasoft.com>2008-09-24 03:45:46 +0000
commit5aec71241c874a2249c14025a7df1eddc1c14654 (patch)
treef719e6b64bb3af39d312ba526cdf6706c2c65c06 /src/unit/fstring.cpp
parent0975d66d2f06603f5e4016440b333aac88e2958a (diff)
downloadlibbu++-5aec71241c874a2249c14025a7df1eddc1c14654.tar.gz
libbu++-5aec71241c874a2249c14025a7df1eddc1c14654.tar.bz2
libbu++-5aec71241c874a2249c14025a7df1eddc1c14654.tar.xz
libbu++-5aec71241c874a2249c14025a7df1eddc1c14654.zip
Added a getSubStr function to Bu::FString, and more tests to the fstring unit
test.
Diffstat (limited to 'src/unit/fstring.cpp')
-rw-r--r--src/unit/fstring.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/unit/fstring.cpp b/src/unit/fstring.cpp
index ea3342a..7be03a7 100644
--- a/src/unit/fstring.cpp
+++ b/src/unit/fstring.cpp
@@ -24,6 +24,8 @@ public:
24 addTest( Unit::add2 ); 24 addTest( Unit::add2 );
25 addTest( Unit::add3 ); 25 addTest( Unit::add3 );
26 addTest( Unit::add4 ); 26 addTest( Unit::add4 );
27 addTest( Unit::add5 );
28 addTest( Unit::subStr1 );
27 } 29 }
28 30
29 virtual ~Unit() 31 virtual ~Unit()
@@ -128,6 +130,25 @@ public:
128 130
129 unitTest( c == "hi there, yeah!" ); 131 unitTest( c == "hi there, yeah!" );
130 } 132 }
133
134 void add5()
135 {
136 Bu::FString b;
137 Bu::FString c = "sup?";
138 b += "hey, " + c;
139
140 unitTest( b == "hey, sup?" );
141 }
142
143 void subStr1()
144 {
145 Bu::FString a("abcdefghijklmnop");
146 unitTest( a.getSubStr( 5, 3 ) == "fgh" );
147 unitTest( a.getSubStr( 10 ) == "klmnop" );
148 unitTest( a.getSubStr( 40 ) == "" );
149 unitTest( a.getSubStr( -10 ) == "abcdefghijklmnop" );
150 unitTest( a.getSubStr( -15, 4 ) == "abcd" );
151 }
131}; 152};
132 153
133int main( int argc, char *argv[] ) 154int main( int argc, char *argv[] )