Moving modules around so the runtime is under one master pom and can be built without building other modules that are in the repository
2 * Back 2 Browser Bytecode Translator
3 * Copyright (C) 2012 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, version 2 of the License.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program. Look for COPYING file in the top folder.
16 * If not, see http://opensource.org/licenses/GPL-2.0.
18 package org.apidesign.vm4brwsr;
20 import static org.testng.Assert.*;
21 import org.testng.annotations.BeforeClass;
22 import org.testng.annotations.Test;
26 * @author Jaroslav Tulach <jtulach@netbeans.org>
28 public class ArrayTest {
29 @Test public void intArrayShouldBeFilledWithZeroes() throws Exception {
30 assertExec("0 + 0", Array.class, "sum__II",
34 @Test public void verifySimpleIntOperation() throws Exception {
35 assertExec("CheckTheSum", Array.class, "simple__IZ",
36 Double.valueOf(15), false
40 @Test public void cloneOnArray() throws Exception {
41 assertExec("CheckTheSum on clone", Array.class, "simple__IZ",
42 Double.valueOf(15), true
46 @Test public void realOperationOnArrays() throws Exception {
47 assertEquals(Array.sum(), 105.0, "Computes to 105");
50 @Test public void verifyOperationsOnArrays() throws Exception {
51 assertExec("The sum is 105", Array.class, "sum__D",
56 @Test public void twoDoubles() throws Exception {
57 assertExec("Elements are initialized", Array.class, "twoDoubles__D",
61 @Test public void twoInts() throws Exception {
62 assertExec("Elements are initialized", Array.class, "twoInts__I",
67 @Test public void doesCopyArrayWork() throws Exception {
68 assertExec("Returns 'a'", Array.class, "copyArray__C", Double.valueOf('a'));
71 @Test public void verifyObjectArrayClass() throws Exception {
72 assertExec("Returns 'Object[]'", Array.class, "objectArrayClass__Ljava_lang_String_2", Array.objectArrayClass());
74 @Test public void verifyInstanceOfArray() throws Exception {
75 assertExec("Returns 'false'", Array.class, "instanceOfArray__ZLjava_lang_Object_2", Double.valueOf(0), "non-array");
78 private static TestVM code;
81 public void compileTheCode() throws Exception {
82 code = TestVM.compileClass("org/apidesign/vm4brwsr/Array");
84 private static void assertExec(String msg, Class clazz, String method, Object expRes, Object... args) throws Exception {
85 code.assertExec(msg, clazz, method, expRes, args);