1 /* 2 * Copyright (c) 2015, 2015, Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * This code is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. 8 * 9 * This code is distributed in the hope that it will be useful, but WITHOUT 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 * version 2 for more details (a copy is included in the LICENSE file that 13 * accompanied this code). 14 * 15 * You should have received a copy of the GNU General Public License version 16 * 2 along with this work; if not, write to the Free Software Foundation, 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 * 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 * or visit www.oracle.com if you need additional information or have any 21 * questions. 22 */ 23 package org.graalvm.compiler.jtt.jdk; 24 25 import org.junit.Test; 26 27 import org.graalvm.compiler.jtt.JTTTest; 28 29 public class DivideUnsigned extends JTTTest { 30 31 public static int divUInt(int a, int b) { 32 return Integer.divideUnsigned(a, b); 33 } 34 35 public static int remUInt(int a, int b) { 36 return Integer.remainderUnsigned(a, b); 37 } 38 39 public static long divULong(long a, long b) { 40 return Long.divideUnsigned(a, b); 41 } 42 43 public static long remULong(long a, long b) { 44 return Long.remainderUnsigned(a, b); 45 } 46 47 public void testInt(int a, int b) { 48 runTest("divUInt", a, b); 49 runTest("remUInt", a, b); 50 } 51 52 public void testLong(long a, long b) { 53 runTest("divULong", a, b); 54 runTest("remULong", a, b); 55 } 56 57 @Test 58 public void testIntPP() { 59 testInt(5, 2); 60 } 61 62 @Test 63 public void testIntNP() { 64 testInt(-5, 2); 65 } 66 67 @Test 68 public void testIntPN() { 69 testInt(5, -2); 70 } 71 72 @Test 73 public void testIntNN() { 74 testInt(-5, -2); 75 } 76 77 @Test 78 public void testLongPP() { 79 testLong(5, 2); 80 } 81 82 @Test 83 public void testLongNP() { 84 testLong(-5, 2); 85 } 86 87 @Test 88 public void testLongPN() { 89 testLong(5, -2); 90 } 91 92 @Test 93 public void testLongNN() { 94 testLong(-5, -2); 95 } 96 }