From eef90444774d02fa0d3a10dc9713df4f8fc933c1 Mon Sep 17 00:00:00 2001 From: William S Fulton Date: Sat, 1 May 2010 10:01:26 +0000 Subject: [PATCH] More string tests: char const*const git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12005 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Examples/test-suite/char_strings.i | 14 +++++++++++++- Examples/test-suite/csharp/char_strings_runme.cs | 10 ++++++++++ Examples/test-suite/java/char_strings_runme.java | 10 ++++++++++ 3 files changed, 33 insertions(+), 1 deletion(-) diff --git a/Examples/test-suite/char_strings.i b/Examples/test-suite/char_strings.i index 26f3f22a5..cc59815b2 100644 --- a/Examples/test-suite/char_strings.i +++ b/Examples/test-suite/char_strings.i @@ -21,7 +21,7 @@ below. static char *global_str = NULL; const int UINT_DIGITS = 10; // max unsigned int is 4294967295 -bool check(const char *str, unsigned int number) { +bool check(const char *const str, unsigned int number) { static char expected[256]; sprintf(expected, "%s%d", OTHERLAND_MSG, number); bool matches = (strcmp(str, expected) == 0); @@ -105,6 +105,18 @@ bool SetConstCharArrayStaticString(const char str[], unsigned int number) { return check(static_str, number); } +bool SetCharConstStaticString(char *const str, unsigned int number) { + static char static_str[] = CPLUSPLUS_MSG; + strcpy(static_str, str); + return check(static_str, number); +} + +bool SetConstCharConstStaticString(const char *const str, unsigned int number) { + static char static_str[] = CPLUSPLUS_MSG; + strcpy(static_str, str); + return check(static_str, number); +} + // get set function char *CharPingPong(char *str) { return str; diff --git a/Examples/test-suite/csharp/char_strings_runme.cs b/Examples/test-suite/csharp/char_strings_runme.cs index 59bcc64df..414d32b7a 100644 --- a/Examples/test-suite/csharp/char_strings_runme.cs +++ b/Examples/test-suite/csharp/char_strings_runme.cs @@ -76,6 +76,16 @@ public class char_strings_runme { throw new Exception("Test char set 6 failed, iteration " + i); } + for (i=0; i