001/*
002 * Copyright (c) 2015, 2015, Oracle and/or its affiliates. All rights reserved.
003 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
004 *
005 * This code is free software; you can redistribute it and/or modify it
006 * under the terms of the GNU General Public License version 2 only, as
007 * published by the Free Software Foundation.
008 *
009 * This code is distributed in the hope that it will be useful, but WITHOUT
010 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
011 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
012 * version 2 for more details (a copy is included in the LICENSE file that
013 * accompanied this code).
014 *
015 * You should have received a copy of the GNU General Public License version
016 * 2 along with this work; if not, write to the Free Software Foundation,
017 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
018 *
019 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
020 * or visit www.oracle.com if you need additional information or have any
021 * questions.
022 */
023package com.oracle.graal.jtt.jdk;
024
025import org.junit.*;
026
027import com.oracle.graal.jtt.*;
028
029public class DivideUnsigned extends JTTTest {
030
031    public static int divUInt(int a, int b) {
032        return Integer.divideUnsigned(a, b);
033    }
034
035    public static int remUInt(int a, int b) {
036        return Integer.remainderUnsigned(a, b);
037    }
038
039    public static long divULong(long a, long b) {
040        return Long.divideUnsigned(a, b);
041    }
042
043    public static long remULong(long a, long b) {
044        return Long.remainderUnsigned(a, b);
045    }
046
047    public void testInt(int a, int b) {
048        runTest("divUInt", a, b);
049        runTest("remUInt", a, b);
050    }
051
052    public void testLong(long a, long b) {
053        runTest("divULong", a, b);
054        runTest("remULong", a, b);
055    }
056
057    @Test
058    public void testIntPP() {
059        testInt(5, 2);
060    }
061
062    @Test
063    public void testIntNP() {
064        testInt(-5, 2);
065    }
066
067    @Test
068    public void testIntPN() {
069        testInt(5, -2);
070    }
071
072    @Test
073    public void testIntNN() {
074        testInt(-5, -2);
075    }
076
077    @Test
078    public void testLongPP() {
079        testLong(5, 2);
080    }
081
082    @Test
083    public void testLongNP() {
084        testLong(-5, 2);
085    }
086
087    @Test
088    public void testLongPN() {
089        testLong(5, -2);
090    }
091
092    @Test
093    public void testLongNN() {
094        testLong(-5, -2);
095    }
096}