diff options
Diffstat (limited to 'src/unit/fstring.cpp')
-rw-r--r-- | src/unit/fstring.cpp | 21 |
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 | ||
133 | int main( int argc, char *argv[] ) | 154 | int main( int argc, char *argv[] ) |