Commit e2332116 authored by Derek Xu's avatar Derek Xu
Browse files

Add unit test for issue #4

parent e43d3973
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -12,7 +12,7 @@ public class Bullet extends Sprite {
     */
    public Bullet(int xPos, int yPos, int xVel, int yVel, int screenWidth, int screenHeight, Resources res) {
        super(xPos, yPos, xVel, yVel, screenWidth, screenHeight);
        spriteImage = BitmapFactory.decodeResource(res, R.drawable.red);
        spriteImage = BitmapFactory.decodeResource(res, R.drawable.bullet);
        spriteImage = Bitmap.createScaledBitmap(spriteImage, screenWidth, screenHeight, false);
    }

+19 −2
Original line number Diff line number Diff line
@@ -4,14 +4,31 @@ import org.junit.Test;

import static org.junit.Assert.*;



/**
 * Example local unit test, which will execute on the development machine (host).
 * Positive number unit test, which will execute on the development machine (host).
 *
 * @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
 */
public class ExampleUnitTest {
    /**
     *
     * @param num A number of type T
     * @return true iff num is greater than 0
     * @param <T> A type that extends Number
     */
    <T extends Number> boolean amIPositive(T num) {
        return (num.doubleValue() > 0);
    }

    @Test
    public void addition_isCorrect() {
        assertEquals(4, 2 + 2);
    }

    @Test
    public void testAmIPositive() {
        assertTrue(amIPositive(0.3));
    }
}