mirror of https://github.com/swig/swig
More string tests: char const*const
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12005 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
89a8bd2abf
commit
eef9044477
|
@ -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;
|
||||
|
|
|
@ -76,6 +76,16 @@ public class char_strings_runme {
|
|||
throw new Exception("Test char set 6 failed, iteration " + i);
|
||||
}
|
||||
|
||||
for (i=0; i<count; i++) {
|
||||
if (!char_strings.SetCharConstStaticString(OTHERLAND_MSG + i, i))
|
||||
throw new Exception("Test char set 7 failed, iteration " + i);
|
||||
}
|
||||
|
||||
for (i=0; i<count; i++) {
|
||||
if (!char_strings.SetConstCharConstStaticString(OTHERLAND_MSG + i, i))
|
||||
throw new Exception("Test char set 8 failed, iteration " + i);
|
||||
}
|
||||
|
||||
// get set function
|
||||
for (i=0; i<count*10; i++) {
|
||||
string ping = OTHERLAND_MSG + i;
|
||||
|
|
|
@ -83,6 +83,16 @@ public class char_strings_runme {
|
|||
throw new RuntimeException("Test char set 6 failed, iteration " + i);
|
||||
}
|
||||
|
||||
for (i=0; i<count; i++) {
|
||||
if (!char_strings.SetCharConstStaticString(OTHERLAND_MSG + i, i))
|
||||
throw new RuntimeException("Test char set 7 failed, iteration " + i);
|
||||
}
|
||||
|
||||
for (i=0; i<count; i++) {
|
||||
if (!char_strings.SetConstCharConstStaticString(OTHERLAND_MSG + i, i))
|
||||
throw new RuntimeException("Test char set 8 failed, iteration " + i);
|
||||
}
|
||||
|
||||
// get set function
|
||||
for (i=0; i<count; i++) {
|
||||
String ping = OTHERLAND_MSG + i;
|
||||
|
|
Loading…
Reference in New Issue