add setter into test

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@6971 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
William S Fulton 2005-02-17 22:23:37 +00:00
commit 995034cd2f
2 changed files with 11 additions and 5 deletions

View file

@ -28,10 +28,6 @@ public class java_lib_various_runme {
if ( !got[i].equals(expected[i]) )
throw new RuntimeException("Name failed " + i + " " + got[i] + "|" + expected[i]);
// STRING_ARRAY variable setter
// String newLangs[] = { "French", "Italian", "Spanish" };
// java_lib_various.setLanguages(newLangs);
// STRING_ARRAY variable getter
String langscheck[] = { "Hungarian", "Afrikaans", "Norwegian" };
String langs[] = java_lib_various.getLanguages();
@ -39,6 +35,16 @@ public class java_lib_various_runme {
if ( !langs[i].equals(langscheck[i]) )
throw new RuntimeException("Languages read failed " + i + " " + langs[i] + "|" + langscheck[i]);
// STRING_ARRAY variable setter
String newLangs[] = { "French", "Italian", "Spanish" };
java_lib_various.setLanguages(newLangs);
// STRING_ARRAY variable getter
langs = java_lib_various.getLanguages();
for (int i=0; i<langs.length; i++)
if ( !langs[i].equals(newLangs[i]) )
throw new RuntimeException("Languages verify failed " + i + " " + langs[i] + "|" + newLangs[i]);
// STRING_RET test
{
String stringOutArray[] = { "" };

View file

@ -8,12 +8,12 @@
%apply char **STRING_ARRAY { char **languages };
%apply char *BYTE { char *chars };
%apply char **STRING_OUT { char **string_ptr };
%typemap(freearg) char **languages "" // don't delete memory when setting global variable
%{
char *langs[] = { (char *)"Hungarian", (char *)"Afrikaans", (char *)"Norwegian", NULL };
%}
%immutable languages; /* TODO: fix, because there is a problem with setters */
%inline %{
char **languages = &langs[0];
%}