diff options
author | Arne Schwabe <arne@rfc2549.org> | 2021-10-03 02:29:42 +0200 |
---|---|---|
committer | Arne Schwabe <arne@rfc2549.org> | 2021-10-03 02:53:26 +0200 |
commit | c3a0f99f9058b5ee602a9f19f7453804d4d26928 (patch) | |
tree | ee45ddf9fc2ce4b21273a71e7be1b6367628f83b /main | |
parent | ba7fedf2030dcdf13f7a2cf83559e4daa14f623c (diff) |
Move Ui specific unit tests to Ui specific test file
Diffstat (limited to 'main')
-rw-r--r-- | main/src/test/java/de/blinkt/openvpn/core/TestConfigParser.kt | 10 | ||||
-rw-r--r-- | main/src/testui/java/de/blinkt/openvpn/core/TestUiUtils.kt | 12 |
2 files changed, 14 insertions, 8 deletions
diff --git a/main/src/test/java/de/blinkt/openvpn/core/TestConfigParser.kt b/main/src/test/java/de/blinkt/openvpn/core/TestConfigParser.kt index c9dd64a2..0830c32c 100644 --- a/main/src/test/java/de/blinkt/openvpn/core/TestConfigParser.kt +++ b/main/src/test/java/de/blinkt/openvpn/core/TestConfigParser.kt @@ -9,7 +9,6 @@ import android.content.Context import android.os.Build import androidx.test.core.app.ApplicationProvider import de.blinkt.openvpn.R -import de.blinkt.openvpn.fragments.Utils import org.junit.Assert import org.junit.Test import org.junit.runner.RunWith @@ -173,7 +172,6 @@ class TestConfigParser { val vp = cp.convertProfile() Assert.assertEquals(20707, vp.mCompatMode) - Assert.assertEquals(0,Utils.mapCompatVer(vp.mCompatMode)) val config2 = config + "compat-mode 2.4.0\n" @@ -182,7 +180,6 @@ class TestConfigParser { cp.parseConfig(StringReader(config2)) val vp2 = cp.convertProfile() Assert.assertEquals(20400, vp2.mCompatMode) - Assert.assertEquals(2,Utils.mapCompatVer(vp2.mCompatMode)) val conf2 = vp2.getConfigFile(c, false) Assert.assertTrue(conf2.contains("compat-mode 2.4.0")); @@ -190,10 +187,9 @@ class TestConfigParser { cp.parseConfig(StringReader(config3)) val vp3 = cp.convertProfile() Assert.assertEquals(11723, vp3.mCompatMode) - Assert.assertEquals(3,Utils.mapCompatVer(vp3.mCompatMode)) val conf = vp3.getConfigFile(c, false) - Assert.assertTrue(conf.contains("compat-mode 1.17.23")); + Assert.assertTrue(conf.contains("compat-mode 1.17.23")) } @Test @@ -323,13 +319,11 @@ class TestConfigParser { val cp = ConfigParser() cp.parseConfig(StringReader(proxyconf)) val vp = cp.convertProfile() - var config = vp.getConfigFile(ApplicationProvider.getApplicationContext(), true) - Assert.assertEquals(vp.checkProfile(ApplicationProvider.getApplicationContext(), true).toLong(), R.string.no_error_found.toLong()) Assert.assertEquals(vp.checkProfile(ApplicationProvider.getApplicationContext(), false).toLong(), R.string.no_error_found.toLong()) - config = vp.getConfigFile(ApplicationProvider.getApplicationContext(), false) + val config = vp.getConfigFile(ApplicationProvider.getApplicationContext(), false) Assert.assertTrue(config.contains("http-proxy 1.2.3.4")) Assert.assertFalse(config.contains("management-query-proxy")) diff --git a/main/src/testui/java/de/blinkt/openvpn/core/TestUiUtils.kt b/main/src/testui/java/de/blinkt/openvpn/core/TestUiUtils.kt new file mode 100644 index 00000000..8bc2e4fa --- /dev/null +++ b/main/src/testui/java/de/blinkt/openvpn/core/TestUiUtils.kt @@ -0,0 +1,12 @@ +import de.blinkt.openvpn.fragments.Utils +import org.junit.Assert +import org.junit.Test + +class TestUiUtils { + @Test + fun testCompatModeUtil() { + Assert.assertEquals(2, Utils.mapCompatVer(20400)) + Assert.assertEquals(0, Utils.mapCompatVer(20707)) + Assert.assertEquals(3, Utils.mapCompatVer(11723)) + } +}
\ No newline at end of file |