Mercurial > hg > icedrobot > daneel
view src/test/java/org/icedrobot/daneel/rewriter/ReturnTest.java @ 83:2096dd888607
(no commit message)Convert the tests of the old testframe to the new testframe with DexifyingRunner
author | volker |
---|---|
date | Sat, 26 Mar 2011 16:48:03 +0100 |
parents | src/test/java/org/icedrobot/daneel/rewriter/DexRewriter_MethodRewriterTest.java@ba55a434c9c0 |
children |
line wrap: on
line source
/* * Daneel - Dalvik to Java bytecode compiler * Copyright (C) 2011 IcedRobot team * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. * * This file is subject to the "Classpath" exception: * * Linking this library statically or dynamically with other modules is * making a combined work based on this library. Thus, the terms and * conditions of the GNU General Public License cover the whole * combination. * * As a special exception, the copyright holders of this library give you * permission to link this library with independent modules to produce an * executable, regardless of the license terms of these independent * modules, and to copy and distribute the resulting executable under terms * of your choice, provided that you also meet, for each linked independent * module, the terms and conditions of the license of that module. An * independent module is a module which is not derived from or based on * this library. If you modify this library, you may extend this exception * to your version of the library, but you are not obligated to do so. If * you do not wish to do so, delete this exception statement from your * version. */ package org.icedrobot.daneel.rewriter; import static org.junit.Assert.assertEquals; import org.icedrobot.daneel.DexifyingRunner; import org.junit.Test; import org.junit.runner.RunWith; @RunWith(DexifyingRunner.class) public class ReturnTest { @Test public void returnLong() throws Exception { assertEquals(-1L, new DEXCode().returnLong()); } @Test public void returnInt() throws Exception { assertEquals(25, new DEXCode().returnInt()); } @Test public void returnShort() throws Exception { assertEquals((short) -1, new DEXCode().returnShort()); } @Test public void returnByte() throws Exception { assertEquals((byte) -25, new DEXCode().returnByte()); } @Test public void returnChar() throws Exception { assertEquals('a', new DEXCode().returnChar()); } @Test public void returnDouble() throws Exception { assertEquals(44.0, new DEXCode().returnDouble(), 0); } @Test public void returnFloat() throws Exception { assertEquals(37.0F, new DEXCode().returnFloat(), 0); } @Test public void returnThis() throws Exception { DEXCode dex = new DEXCode(); assertEquals(dex, dex.returnThis()); } @Test public void returnNull() throws Exception { assertEquals(null, new DEXCode().returnNull()); } @Test public void returnString() throws Exception { assertEquals("any string", new DEXCode().returnString()); } // Keep this class named "DEXCode" to push it through Daneel. private static class DEXCode { public long returnLong() { return -1; } public int returnInt() { return 25; } public short returnShort() { return -1; } public byte returnByte() { return -25; } public char returnChar() { return 'a'; } public double returnDouble() { return 44; } public float returnFloat() { return 37; } public Object returnThis() { return this; } public Object returnNull() { return null; } public String returnString() { return "any string"; } } }