diff options
author | Mike Buland <eichlan@xagasoft.com> | 2007-11-23 23:47:37 +0000 |
---|---|---|
committer | Mike Buland <eichlan@xagasoft.com> | 2007-11-23 23:47:37 +0000 |
commit | c9574d3f77081fb4a654d42c298d6ebf34abca51 (patch) | |
tree | 0410f4d63923984eb3fe2daac10bae9145e45032 /src/unit/fstring.cpp | |
parent | cd215f0da23e16c3f1a7200f2b9f67f23c9b4be7 (diff) | |
download | libbu++-c9574d3f77081fb4a654d42c298d6ebf34abca51.tar.gz libbu++-c9574d3f77081fb4a654d42c298d6ebf34abca51.tar.bz2 libbu++-c9574d3f77081fb4a654d42c298d6ebf34abca51.tar.xz libbu++-c9574d3f77081fb4a654d42c298d6ebf34abca51.zip |
Bu::FString now has insert and remove functions, yay!
Diffstat (limited to 'src/unit/fstring.cpp')
-rw-r--r-- | src/unit/fstring.cpp | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/unit/fstring.cpp b/src/unit/fstring.cpp index 69c7e0a..03df9c3 100644 --- a/src/unit/fstring.cpp +++ b/src/unit/fstring.cpp | |||
@@ -18,6 +18,8 @@ public: | |||
18 | addTest( Unit::compare2 ); | 18 | addTest( Unit::compare2 ); |
19 | addTest( Unit::appendSingle ); | 19 | addTest( Unit::appendSingle ); |
20 | addTest( Unit::shared1 ); | 20 | addTest( Unit::shared1 ); |
21 | addTest( Unit::insert ); | ||
22 | addTest( Unit::remove ); | ||
21 | } | 23 | } |
22 | 24 | ||
23 | virtual ~Unit() | 25 | virtual ~Unit() |
@@ -57,6 +59,34 @@ public: | |||
57 | a = b; | 59 | a = b; |
58 | unitTest( a.getStr() == b.getStr() ); | 60 | unitTest( a.getStr() == b.getStr() ); |
59 | } | 61 | } |
62 | |||
63 | void insert() | ||
64 | { | ||
65 | Bu::FString a("abcd"); | ||
66 | a.insert( 2, "-!-", 3 ); | ||
67 | unitTest( a == "ab-!-cd" ); | ||
68 | |||
69 | a.insert( 0, "!!", 2 ); | ||
70 | unitTest( a == "!!ab-!-cd" ); | ||
71 | |||
72 | a.insert( -10, "789", 3 ); | ||
73 | unitTest( a == "789!!ab-!-cd" ); | ||
74 | |||
75 | a.insert( 12, "89", 2 ); | ||
76 | unitTest( a == "789!!ab-!-cd89" ); | ||
77 | |||
78 | a.insert( 1203, "12", 2 ); | ||
79 | unitTest( a == "789!!ab-!-cd8912" ); | ||
80 | } | ||
81 | |||
82 | void remove() | ||
83 | { | ||
84 | Bu::FString a("abHEYcd"); | ||
85 | a.remove( 2, 3 ); | ||
86 | unitTest( a == "abcd" ); | ||
87 | a.remove( 2, 5 ); | ||
88 | unitTest( a == "ab" ); | ||
89 | } | ||
60 | }; | 90 | }; |
61 | 91 | ||
62 | int main( int argc, char *argv[] ) | 92 | int main( int argc, char *argv[] ) |