jaroslav@1965
|
1 |
/**
|
jaroslav@1965
|
2 |
* Back 2 Browser Bytecode Translator
|
jaroslav@1965
|
3 |
* Copyright (C) 2012-2015 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
|
jaroslav@1965
|
4 |
*
|
jaroslav@1965
|
5 |
* This program is free software: you can redistribute it and/or modify
|
jaroslav@1965
|
6 |
* it under the terms of the GNU General Public License as published by
|
jaroslav@1965
|
7 |
* the Free Software Foundation, version 2 of the License.
|
jaroslav@1965
|
8 |
*
|
jaroslav@1965
|
9 |
* This program is distributed in the hope that it will be useful,
|
jaroslav@1965
|
10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
jaroslav@1965
|
11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
jaroslav@1965
|
12 |
* GNU General Public License for more details.
|
jaroslav@1965
|
13 |
*
|
jaroslav@1965
|
14 |
* You should have received a copy of the GNU General Public License
|
jaroslav@1965
|
15 |
* along with this program. Look for COPYING file in the top folder.
|
jaroslav@1965
|
16 |
* If not, see http://opensource.org/licenses/GPL-2.0.
|
jaroslav@1965
|
17 |
*/
|
jaroslav@1965
|
18 |
package org.apidesign.vm4brwsr;
|
jaroslav@1965
|
19 |
|
jaroslav@1965
|
20 |
import org.testng.annotations.AfterClass;
|
jaroslav@1965
|
21 |
import org.testng.annotations.BeforeClass;
|
jaroslav@1965
|
22 |
import org.testng.annotations.Test;
|
jaroslav@1965
|
23 |
|
jaroslav@1965
|
24 |
public class LibUseTest {
|
jaroslav@1965
|
25 |
private static TestVM code;
|
jaroslav@1965
|
26 |
|
jaroslav@1965
|
27 |
@BeforeClass
|
jaroslav@1965
|
28 |
public static void initVM() throws Exception {
|
jaroslav@1965
|
29 |
code = TestVM.compileClass("org/apidesign/vm4brwsr/LibUse");
|
jaroslav@1965
|
30 |
}
|
jaroslav@1965
|
31 |
@AfterClass
|
jaroslav@1965
|
32 |
public static void releaseTheCode() {
|
jaroslav@1965
|
33 |
code = null;
|
jaroslav@1965
|
34 |
}
|
jaroslav@1965
|
35 |
|
jaroslav@1965
|
36 |
@Test
|
jaroslav@1965
|
37 |
public void fourtyTwo() throws Exception {
|
jaroslav@1965
|
38 |
code.assertExec("Fourty two", LibUse.class, "fourtyTwo__I", 42);
|
jaroslav@1965
|
39 |
}
|
jaroslav@1966
|
40 |
|
jaroslav@1966
|
41 |
@Test
|
jaroslav@1966
|
42 |
public void readAHiProperty() throws Exception {
|
jaroslav@1968
|
43 |
code.assertExec(
|
jaroslav@1968
|
44 |
"Object has property x", LibUse.class,
|
jaroslav@1968
|
45 |
"hiProperty__Ljava_lang_String_2Ljava_lang_String_2",
|
jaroslav@1968
|
46 |
"Hi", (Object)null
|
jaroslav@1968
|
47 |
);
|
jaroslav@1968
|
48 |
}
|
jaroslav@1968
|
49 |
|
jaroslav@1968
|
50 |
@Test
|
jaroslav@1968
|
51 |
public void writeAHiProperty() throws Exception {
|
jaroslav@1968
|
52 |
code.assertExec(
|
jaroslav@1968
|
53 |
"Object has property x", LibUse.class,
|
jaroslav@1968
|
54 |
"hiProperty__Ljava_lang_String_2Ljava_lang_String_2",
|
jaroslav@1968
|
55 |
"Ahoj", "Ahoj"
|
jaroslav@1968
|
56 |
);
|
jaroslav@1966
|
57 |
}
|
jaroslav@1970
|
58 |
|
jaroslav@1970
|
59 |
@Test
|
jaroslav@1970
|
60 |
public void optionalParams1() throws Exception {
|
jaroslav@1970
|
61 |
code.assertExec(
|
jaroslav@1970
|
62 |
"Fifteen", LibUse.class,
|
jaroslav@1970
|
63 |
"parse__DLjava_lang_String_2",
|
jaroslav@1970
|
64 |
15, "0xF"
|
jaroslav@1970
|
65 |
);
|
jaroslav@1970
|
66 |
}
|
jaroslav@1970
|
67 |
|
jaroslav@1970
|
68 |
@Test
|
jaroslav@1970
|
69 |
public void optionalParams2() throws Exception {
|
jaroslav@1970
|
70 |
code.assertExec(
|
jaroslav@1970
|
71 |
"Fifteen", LibUse.class,
|
jaroslav@1970
|
72 |
"parse__DLjava_lang_String_2I",
|
jaroslav@1970
|
73 |
15, "F", 16
|
jaroslav@1970
|
74 |
);
|
jaroslav@1970
|
75 |
}
|
jaroslav@1971
|
76 |
|
jaroslav@1971
|
77 |
@Test
|
jaroslav@1971
|
78 |
public void verifyNaN() throws Exception {
|
jaroslav@1971
|
79 |
code.assertExec(
|
jaroslav@1971
|
80 |
"Check NaN", LibUse.class,
|
jaroslav@1971
|
81 |
"checkNaN__Z",
|
jaroslav@1971
|
82 |
true
|
jaroslav@1971
|
83 |
);
|
jaroslav@1971
|
84 |
}
|
jaroslav@1972
|
85 |
|
jaroslav@1972
|
86 |
@Test
|
jaroslav@1972
|
87 |
public void assertDateOperation() throws Exception {
|
jaroslav@1972
|
88 |
code.assertExec(
|
jaroslav@1972
|
89 |
"Create and read date", LibUse.class,
|
jaroslav@1972
|
90 |
"dateOperation__D",
|
jaroslav@1972
|
91 |
2017.0
|
jaroslav@1972
|
92 |
);
|
jaroslav@1972
|
93 |
}
|
jaroslav@1974
|
94 |
|
jaroslav@1974
|
95 |
@Test
|
jaroslav@1974
|
96 |
public void directArray() throws Exception {
|
jaroslav@1974
|
97 |
code.assertExec(
|
jaroslav@1974
|
98 |
"Create and read date", LibUse.class,
|
jaroslav@1974
|
99 |
"arrayForEach__D",
|
jaroslav@1974
|
100 |
6.3
|
jaroslav@1974
|
101 |
);
|
jaroslav@1974
|
102 |
}
|
jaroslav@1965
|
103 |
}
|