- // Test that cached_str is cleared
- mono_test_marshal_stringbuilder2 (sb, sb.Capacity);
- res = sb.ToString();
- if (res != "EFGH")
- return 2;
+ // Test StringBuilder with default capacity (16)
+ StringBuilder sb2 = new StringBuilder();
+ mono_test_marshal_stringbuilder_default (sb2, sb2.Capacity);
+ if (sb2.ToString () != "This is my messa")
+ return 3;
+
+ return 0;
+ }
+
+ public static int test_0_marshal_stringbuilder_append () {
+ const String in_sentinel = "MONO_";
+ const String out_sentinel = "CSHARP_";
+ const int iterations = 100;
+ StringBuilder sb = new StringBuilder(255);
+ StringBuilder check = new StringBuilder(255);
+
+ for (int i = 0; i < iterations; i++) {
+ sb.Append (in_sentinel[i % in_sentinel.Length]);
+ check.Append (out_sentinel[i % out_sentinel.Length]);
+
+ mono_test_marshal_stringbuilder_append (sb, sb.Length);
+
+ String res = sb.ToString();
+ String checkRev = check.ToString();
+ if (res != checkRev)
+ return 1;
+ }