diff options
author | William S Fulton <wsf@fultondesigns.co.uk> | 2019-07-23 19:38:00 +0100 |
---|---|---|
committer | William S Fulton <wsf@fultondesigns.co.uk> | 2019-07-23 19:41:25 +0100 |
commit | 2d36b3468a9d26a352a3d23e06aab012f6b7fb9f (patch) | |
tree | d5063197b20ee6afcd7219502e51d95f237dfcba | |
parent | eb6efdb60b1da8ec3341280ac79bb76373ad8bfc (diff) | |
download | swig-2d36b3468a9d26a352a3d23e06aab012f6b7fb9f.tar.gz |
More C# wstring testing
-rw-r--r-- | Examples/test-suite/csharp/li_std_wstring_runme.cs | 31 |
1 files changed, 26 insertions, 5 deletions
diff --git a/Examples/test-suite/csharp/li_std_wstring_runme.cs b/Examples/test-suite/csharp/li_std_wstring_runme.cs index a9bcf9b1e..b69d2c8bb 100644 --- a/Examples/test-suite/csharp/li_std_wstring_runme.cs +++ b/Examples/test-suite/csharp/li_std_wstring_runme.cs @@ -6,13 +6,13 @@ public class runme static private void check_equal(char a, char b) { if (a != b) - throw new Exception("failed " + a + " " + b); + throw new Exception("char failed '" + a + "' != '" + b + "'"); } static private void check_equal(string a, string b) { if (a != b) - throw new Exception("failed " + a + " " + b); + throw new Exception("string failed '" + a + "' != '" + b + "'"); } static void Main() @@ -58,6 +58,7 @@ public class runme string s = "abc"; if (!li_std_wstring.test_equal_abc(s)) throw new Exception("Not equal " + s); + */ try { li_std_wstring.test_throw(); @@ -65,6 +66,7 @@ public class runme check_equal(e.Message, "throwing test_throw"); } + /* TODO x = "abc\0def"; check_equal(li_std_wstring.test_value(x), x); check_equal(li_std_wstring.test_ccvalue(x), "abc"); @@ -79,10 +81,29 @@ public class runme foreach (string expected in test_strings) { - string result = li_std_wstring.test_value(expected); + string received = li_std_wstring.test_value(expected); + check_equal(received, expected); + } + + foreach (string expected in test_strings) + { + string received = li_std_wstring.test_const_reference(expected); + check_equal(received, expected); + } + + foreach (string expected in test_strings) + { + string received = li_std_wstring.test_ccvalue(expected); + check_equal(received, expected); + } - if (result != expected) - throw new Exception("test_string failure '" + result + "' != '" + expected + "'"); + foreach (string test_string in test_strings) + { + foreach (char expected in test_string) + { + char received = li_std_wstring.test_wcvalue(expected); + check_equal(received, expected); + } } } } |