Fix external_objects_java module tests under Linux/Mac OS X
[scilab.git] / scilab / modules / external_objects_java / tests / unit_tests / jwrap.dia.ref
1 // =============================================================================
2 // Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
3 // Copyright (C) 2013 - Scilab Enterprises - Sylvestre Ledru
4 //
5 //  This file is distributed under the same license as the Scilab package.
6 // =============================================================================
7 exec("SCI/modules/external_objects_java/tests/unit_tests/ecjclasspath.sce", -1);
8 myString=jwrap("foo");
9 assert_checkequal(jgetclassname(myString),"java.lang.String");
10 a=jwrap(2);
11 assert_checkequal(typeof(a),"_EObj");
12 assert_checkequal(jgetclassname(a),"double");
13 b=junwrap(a);
14 assert_checkequal(typeof(b),"constant");
15 c = jcompile("Test", ["public class Test {";
16 "public int[] returnArrayInt() {";
17 "    return new int[]{1,2,3,4};";
18 "}";
19 "}";]);
20 t = c.new();
21 assert_checkequal(jgetclassname(c),"Test");
22 assert_checkequal(int32([1,2,3,4]), t.returnArrayInt());
23 c = jcompile("Test", ["public class Test {";
24 "public int returnInt() {";
25 "    return 32;";
26 "}";
27 "}";]);
28 t = c.new();
29 assert_checkequal(jgetclassname(c),"Test");
30 assert_checkequal(int32(32), t.returnInt());
31 //////////////////////////////////////////////
32 c = jcompile("Test", ["public class Test {";
33 "public double[] returnDouble() {";
34 "    return new double[]{1,2,3,4};";
35 "}";
36 "}";]);
37 t = c.new();
38 assert_checkequal(jgetclassname(c),"Test");
39 assert_checkequal([1,2,3,4], t.returnDouble());
40 c = jcompile("Test", ["public class Test {";
41 "public double returnDouble() {";
42 "    return 32;";
43 "}";
44 "}";]);
45 t = c.new();
46 assert_checkequal(jgetclassname(c),"Test");
47 assert_checkequal(32, t.returnDouble());
48 //////////////////////////////////////////////
49 c = jcompile("Test", ["public class Test {";
50 "public byte[] returnByte() {";
51 "    return new byte[]{1,2,3,4};";
52 "}";
53 "}";]);
54 t = c.new();
55 assert_checkequal(jgetclassname(c),"Test");
56 assert_checkequal(int8([1,2,3,4]), t.returnByte());
57 c = jcompile("Test", ["public class Test {";
58 "public byte returnByte() {";
59 "    return 32;";
60 "}";
61 "}";]);
62 t = c.new();
63 assert_checkequal(jgetclassname(c),"Test");
64 assert_checkequal(int8(32), t.returnByte());
65 //////////////////////////////////////////////
66 c = jcompile("Test", ["public class Test {";
67 "public short[] returnShort() {";
68 "    return new short[]{1,2,3,4};";
69 "}";
70 "}";]);
71 t = c.new();
72 assert_checkequal(jgetclassname(c),"Test");
73 assert_checkequal(int16([1,2,3,4]), t.returnShort());
74 c = jcompile("Test", ["public class Test {";
75 "public short returnShort() {";
76 "    return 32;";
77 "}";
78 "}";]);
79 t = c.new();
80 assert_checkequal(jgetclassname(c),"Test");
81 assert_checkequal(int16(32), t.returnShort());
82 //////////////////////////////////////////////
83 c = jcompile("Test", ["public class Test {";
84 "public long[] returnLong() {";
85 "    return new long[]{1L,2L,3L,4L};";
86 "}";
87 "}";]);
88 t = c.new();
89 assert_checkequal(jgetclassname(c),"Test");
90 assert_checkequal(int32([1,2,3,4]), t.returnLong());
91 c = jcompile("Test", ["public class Test {";
92 "public long returnLong() {";
93 "    return 32L;";
94 "}";
95 "}";]);
96 t = c.new();
97 assert_checkequal(jgetclassname(c),"Test");
98 assert_checkequal(int32(32), t.returnLong());
99 //////////////////////////////////////////////
100 c = jcompile("Test", ["public class Test {";
101 "public float[] returnFloat() {";
102 "    return new float[]{1f,2f,3f,4f};";
103 "}";
104 "}";]);
105 t = c.new();
106 assert_checkequal(jgetclassname(c),"Test");
107 assert_checkequal([1,2,3,4], t.returnFloat());
108 c = jcompile("Test", ["public class Test {";
109 "public float returnFloat() {";
110 "    return 32f;";
111 "}";
112 "}";]);
113 t = c.new();
114 assert_checkequal(jgetclassname(c),"Test");
115 assert_checkequal(32, t.returnFloat());
116 //////////////////////////////////////////////
117 // c = jcompile("Test", ["public class Test {";
118 //     "public char[] returnChar() {";
119 //     "    return new char[]{''a'',''b'',''c'',''d''};";
120 //     "}";
121 //     "}";]);
122 // t = c.new();
123 // assert_checkequal(jgetclassname(c),"Test");
124 // assert_checkequal(['a','b','c','d'], t.returnChar());
125 // c = jcompile("Test", ["public class Test {";
126 //     "public char returnChar() {";
127 //     "    return ''a'';";
128 //     "}";
129 //     "}";]);
130 // t = c.new();
131 // assert_checkequal(jgetclassname(c),"Test");
132 // assert_checkequal(int16(32), t.returnChar());
133 //////////////////////////////////////////////
134 c = jcompile("Test", ["public class Test {";
135 "public boolean[] returnBoolean() {";
136 "    return new boolean[]{true,true,false,false};";
137 "}";
138 "}";]);
139 t = c.new();
140 assert_checkequal(jgetclassname(c),"Test");
141 assert_checkequal([%t,%t,%f,%f], t.returnBoolean());
142 c = jcompile("Test", ["public class Test {";
143 "public boolean returnBoolean() {";
144 "    return true;";
145 "}";
146 "}";]);
147 t = c.new();
148 assert_checkequal(jgetclassname(c),"Test");
149 assert_checkequal(%t, t.returnBoolean());