diff options
author | Javier <dev.git@javispedro.com> | 2021-03-20 23:57:51 +0100 |
---|---|---|
committer | Javier <dev.git@javispedro.com> | 2021-03-20 23:58:23 +0100 |
commit | 5dfa37788c7f039eff00b27cc0ca8b9b9a71f60e (patch) | |
tree | 6aea7cd13dc6a8cbb771ec1b510a5ac3cf8200f0 /app/src/test/java | |
download | rempe-5dfa37788c7f039eff00b27cc0ca8b9b9a71f60e.tar.gz rempe-5dfa37788c7f039eff00b27cc0ca8b9b9a71f60e.zip |
Initial import
Diffstat (limited to 'app/src/test/java')
-rw-r--r-- | app/src/test/java/android/util/Log.java | 23 | ||||
-rw-r--r-- | app/src/test/java/com/javispedro/rempe/MainActivityTest.java | 40 |
2 files changed, 63 insertions, 0 deletions
diff --git a/app/src/test/java/android/util/Log.java b/app/src/test/java/android/util/Log.java new file mode 100644 index 0000000..e117d5d --- /dev/null +++ b/app/src/test/java/android/util/Log.java @@ -0,0 +1,23 @@ +package android.util; + +public class Log { + public static int d(String tag, String msg) { + System.err.println("DEBUG: " + tag + ": " + msg); + return 0; + } + + public static int i(String tag, String msg) { + System.err.println("INFO: " + tag + ": " + msg); + return 0; + } + + public static int w(String tag, String msg) { + System.err.println("WARN: " + tag + ": " + msg); + return 0; + } + + public static int e(String tag, String msg) { + System.err.println("ERROR: " + tag + ": " + msg); + return 0; + } +} diff --git a/app/src/test/java/com/javispedro/rempe/MainActivityTest.java b/app/src/test/java/com/javispedro/rempe/MainActivityTest.java new file mode 100644 index 0000000..fe0f4c5 --- /dev/null +++ b/app/src/test/java/com/javispedro/rempe/MainActivityTest.java @@ -0,0 +1,40 @@ +package com.javispedro.rempe; + +import org.junit.Test; + +import java.util.ArrayList; +import java.util.Random; + +import static org.junit.Assert.assertEquals; + +public class MainActivityTest { + private final static String TAG = "MainActivityTest"; + + @Test + public void setDeviceNumberList() { + final MainActivity activity = new MainActivity(); + final Random r = new Random(); + + ArrayList<Integer> list = new ArrayList<Integer>(); + activity.setDeviceNumberList(list); + assertEquals(list, activity.getDeviceNumberList()); + + list.add(r.nextInt(30000)); + activity.setDeviceNumberList(list); + assertEquals(list, activity.getDeviceNumberList()); + + for (int i = 0; i < 400; ++i) { + list.add(r.nextInt(list.size()), r.nextInt(60000)); + activity.setDeviceNumberList(list); + assertEquals(list, activity.getDeviceNumberList()); + + list.add(r.nextInt(list.size()), r.nextInt(60000)); + activity.setDeviceNumberList(list); + assertEquals(list, activity.getDeviceNumberList()); + + list.remove(r.nextInt(list.size() - 1)); + activity.setDeviceNumberList(list); + assertEquals(list, activity.getDeviceNumberList()); + } + } +}
\ No newline at end of file |