jaroslav@733: /** jaroslav@733: * Back 2 Browser Bytecode Translator jaroslav@733: * Copyright (C) 2012 Jaroslav Tulach jaroslav@733: * jaroslav@733: * This program is free software: you can redistribute it and/or modify jaroslav@733: * it under the terms of the GNU General Public License as published by jaroslav@733: * the Free Software Foundation, version 2 of the License. jaroslav@733: * jaroslav@733: * This program is distributed in the hope that it will be useful, jaroslav@733: * but WITHOUT ANY WARRANTY; without even the implied warranty of jaroslav@733: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the jaroslav@733: * GNU General Public License for more details. jaroslav@733: * jaroslav@733: * You should have received a copy of the GNU General Public License jaroslav@733: * along with this program. Look for COPYING file in the top folder. jaroslav@733: * If not, see http://opensource.org/licenses/GPL-2.0. jaroslav@733: */ jaroslav@733: package org.apidesign.bck2brwsr.compact.tck; jaroslav@733: jaroslav@733: import org.apidesign.bck2brwsr.vmtest.Compare; jaroslav@733: import org.apidesign.bck2brwsr.vmtest.VMTest; jaroslav@733: import org.testng.annotations.Factory; jaroslav@733: jaroslav@733: jaroslav@733: public class JFXIssuesTest { jaroslav@733: private abstract class Application { jaroslav@733: public abstract int getID(); jaroslav@733: } jaroslav@733: jaroslav@733: private class MyApplication extends Application { jaroslav@733: jaroslav@733: @Override jaroslav@733: public int getID() { jaroslav@733: return 1; jaroslav@733: } jaroslav@733: jaroslav@733: } jaroslav@733: jaroslav@733: @Compare public boolean isClassAssignable() { jaroslav@733: return Application.class.isAssignableFrom(MyApplication.class); jaroslav@733: } lubomir@752: lubomir@752: @Compare public boolean isNaN() { lubomir@752: return Double.isNaN(Double.NaN); lubomir@752: } lubomir@752: lubomir@752: @Compare public boolean isInfinite() { lubomir@752: return Float.isInfinite(Float.NEGATIVE_INFINITY); lubomir@752: } lubomir@752: lubomir@755: @Compare public boolean areTimesEqual() { lubomir@755: long l1 = System.currentTimeMillis(); lubomir@755: long l2 = l1 + 0; lubomir@755: lubomir@755: return l1 == l2; lubomir@755: } jaroslav@771: jaroslav@771: @Compare public boolean roundOnDouble() { jaroslav@771: long l1 = Math.round(System.currentTimeMillis() / 1.1); jaroslav@771: long l2 = l1 + 0; jaroslav@771: jaroslav@771: return l1 == l2; jaroslav@771: } lubomir@755: jaroslav@771: private static long val = 1238078409318L; jaroslav@771: jaroslav@771: @Compare public int valueConvertedToString() { jaroslav@771: return (int) val++; jaroslav@771: } jaroslav@771: jaroslav@771: @Compare public boolean roundOnFloat() { jaroslav@771: final float f = System.currentTimeMillis() / 1.1f; jaroslav@771: int l1 = Math.round(f); jaroslav@771: int l2 = l1 + 0; jaroslav@771: jaroslav@771: assert l1 == l2 : "Round " + l1 + " == " + l2; jaroslav@771: jaroslav@771: return l1 == l2; jaroslav@771: } jaroslav@771: jaroslav@733: @Factory public static Object[] create() { jaroslav@733: return VMTest.create(JFXIssuesTest.class); jaroslav@733: } jaroslav@733: }