Martin@345: /** Martin@345: * Back 2 Browser Bytecode Translator Martin@345: * Copyright (C) 2012 Jaroslav Tulach Martin@345: * Martin@345: * This program is free software: you can redistribute it and/or modify Martin@345: * it under the terms of the GNU General Public License as published by Martin@345: * the Free Software Foundation, version 2 of the License. Martin@345: * Martin@345: * This program is distributed in the hope that it will be useful, Martin@345: * but WITHOUT ANY WARRANTY; without even the implied warranty of Martin@345: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the Martin@345: * GNU General Public License for more details. Martin@345: * Martin@345: * You should have received a copy of the GNU General Public License Martin@345: * along with this program. Look for COPYING file in the top folder. Martin@345: * If not, see http://opensource.org/licenses/GPL-2.0. Martin@345: */ Martin@345: package org.apidesign.vm4brwsr.tck; Martin@345: Martin@345: import org.apidesign.bck2brwsr.core.JavaScriptBody; Martin@345: import org.apidesign.vm4brwsr.Compare; Martin@345: import org.apidesign.vm4brwsr.CompareVMs; Martin@345: import org.testng.annotations.Factory; Martin@345: Martin@345: /** Martin@345: * Martin@345: * @author Jaroslav Tulach Martin@345: */ Martin@345: public class IntegerArithmeticTest { Martin@345: //@JavaScriptBody(args="msg", body="java.lang.System.out.println(msg.toString());") Martin@345: //private static native void log(String msg); Martin@345: Martin@345: @Compare public int overflow() { Martin@345: int v = Integer.MAX_VALUE + 1; Martin@345: return v; Martin@345: } Martin@345: Martin@345: @Compare public int underflow() { Martin@345: int v = Integer.MIN_VALUE - 1; Martin@345: return v; Martin@345: } Martin@345: Martin@345: /* @Compare public int convertToInt() { Martin@345: long v = Long.MAX_VALUE / 2; Martin@345: log("convert: " + v); Martin@345: return (int) v; Martin@345: } */ Martin@345: @Compare public int addAndMaxInt() { Martin@345: return Integer.MAX_VALUE + Integer.MAX_VALUE; Martin@345: } Martin@345: Martin@345: @Compare public int multiplyMaxInt() { Martin@345: return Integer.MAX_VALUE * Integer.MAX_VALUE; Martin@345: } Martin@345: Martin@345: @Factory Martin@345: public static Object[] create() { Martin@345: return CompareVMs.create(IntegerArithmeticTest.class); Martin@345: } Martin@345: }