aboutsummaryrefslogtreecommitdiff
path: root/src/unit/fstring.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/unit/fstring.cpp')
-rw-r--r--src/unit/fstring.cpp30
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
62int main( int argc, char *argv[] ) 92int main( int argc, char *argv[] )