Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/quite/humla.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Peugnet <nicolas.peugnet@lip6.fr>2024-01-11 16:49:05 +0300
committerDaniel Lublin <daniel@lublin.se>2024-01-11 17:12:40 +0300
commit02a1f1a7ec7b1bad7e8a1423b7f7cc189a37963e (patch)
tree4cd470156f4a815cf42405782e0a1448786329e9 /src/androidTest
parente2d6310591f4547fb1602d8d1511db505cd7fccc (diff)
Allow to easily run tests that only require Junit
With this, it is possible to at least run some of the tests by simply running `../../gradlew test` from the humla submodule folder cloned from Mumla.
Diffstat (limited to 'src/androidTest')
-rw-r--r--src/androidTest/java/se/lublin/humla/test/MixerTest.java66
-rw-r--r--src/androidTest/java/se/lublin/humla/test/ModelTest.java50
-rw-r--r--src/androidTest/java/se/lublin/humla/test/URLParserTest.java103
3 files changed, 0 insertions, 219 deletions
diff --git a/src/androidTest/java/se/lublin/humla/test/MixerTest.java b/src/androidTest/java/se/lublin/humla/test/MixerTest.java
deleted file mode 100644
index 43c880b..0000000
--- a/src/androidTest/java/se/lublin/humla/test/MixerTest.java
+++ /dev/null
@@ -1,66 +0,0 @@
-package se.lublin.humla.test;
-
-import junit.framework.TestCase;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import se.lublin.humla.audio.BasicClippingShortMixer;
-import se.lublin.humla.audio.IAudioMixer;
-import se.lublin.humla.audio.IAudioMixerSource;
-
-/**
- * Created by andrew on 16/07/15.
- */
-public class MixerTest extends TestCase {
- /**
- * Tests that mixing order should not affect the output.
- */
- public void testMixerCommutativity(IAudioMixer<float[], short[]> mixer) {
- BasicSource<float[]> pcmA = new BasicSource<>(new float[] { 0.2f, 0.5f, 0.7f }, 3);
- BasicSource<float[]> pcmB = new BasicSource<>(new float[] { 0.3f, 0.5f, 0.5f }, 3);
- BasicSource<float[]> pcmC = new BasicSource<>(new float[] { 0.0f, 0.0f, -0.5f }, 3);
- final short[] outputABC = new short[3];
- final short[] outputCBA = new short[3];
-
- List<IAudioMixerSource<float[]>> sourcesABC = new ArrayList<>();
- sourcesABC.add(pcmA);
- sourcesABC.add(pcmB);
- sourcesABC.add(pcmC);
- List<IAudioMixerSource<float[]>> sourcesCBA = new ArrayList<>();
- sourcesCBA.add(pcmC);
- sourcesCBA.add(pcmB);
- sourcesCBA.add(pcmA);
-
- mixer.mix(sourcesABC, outputABC, 0, 3);
- mixer.mix(sourcesCBA, outputCBA, 0, 3);
-
- for (int i = 0; i < 3; i++) {
- assertEquals("Mixing should be commutative.", outputABC[i], outputCBA[i]);
- }
- }
-
- public void testBasicClippingShortMixer() {
- testMixerCommutativity(new BasicClippingShortMixer());
- }
-
- private static class BasicSource<T> implements IAudioMixerSource<T> {
- private T mSamples;
- private int mLength;
-
- public BasicSource(T samples, int length) {
- mSamples = samples;
- mLength = length;
- }
-
- @Override
- public T getSamples() {
- return mSamples;
- }
-
- @Override
- public int getNumSamples() {
- return mLength;
- }
- }
-}
diff --git a/src/androidTest/java/se/lublin/humla/test/ModelTest.java b/src/androidTest/java/se/lublin/humla/test/ModelTest.java
deleted file mode 100644
index 09d69a7..0000000
--- a/src/androidTest/java/se/lublin/humla/test/ModelTest.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright (C) 2015 Andrew Comminos <andrew@comminos.com>
- *
- * 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/>.
- */
-
-package se.lublin.humla.test;
-
-import junit.framework.TestCase;
-
-import se.lublin.humla.model.Channel;
-import se.lublin.humla.model.User;
-
-/**
- * Tests the Channel-User tree model.
- * Created by andrew on 24/10/15.
- */
-public class ModelTest extends TestCase {
-
- public void testUserAddRemove() {
- Channel root = new Channel(0, false);
- User user = new User(0, "Test user");
- user.setChannel(root);
- assertEquals("Channel user list count is sane", 1, root.getUsers().size());
- assertEquals("Channel subchannel user count is sane", 1, root.getSubchannelUserCount());
-
- Channel sub = new Channel(1, false);
- root.addSubchannel(sub);
- User subuser = new User(1, "Test user in subchannel");
- subuser.setChannel(sub);
- assertEquals("Adding a user to a subchannel doesn't affect the number of direct children of the root", 1, root.getUsers().size());
- assertEquals("Adding a user to a subchannel updates the recursive user count", 2, root.getSubchannelUserCount());
-
- user.setChannel(sub);
- assertEquals("Moving a user to a subchannel updates the number of children of the root", 0, root.getUsers().size());
- assertEquals("Moving a user to a subchannel does not change the recursive user count of the root", 2, root.getSubchannelUserCount());
- assertEquals("Subchannel user count is sane", 2, sub.getUsers().size());
- }
-}
diff --git a/src/androidTest/java/se/lublin/humla/test/URLParserTest.java b/src/androidTest/java/se/lublin/humla/test/URLParserTest.java
deleted file mode 100644
index 851f0ac..0000000
--- a/src/androidTest/java/se/lublin/humla/test/URLParserTest.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * Copyright (C) 2014 Andrew Comminos
- *
- * 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/>.
- */
-
-package se.lublin.humla.test;
-
-import junit.framework.TestCase;
-
-import java.net.MalformedURLException;
-
-import se.lublin.humla.Constants;
-import se.lublin.humla.model.Server;
-import se.lublin.humla.util.MumbleURLParser;
-
-/**
- * Tests the Mumble URL parser.
- * Created by andrew on 03/03/14.
- */
-public class URLParserTest extends TestCase {
-
- public void testURL() {
- String url = "mumble://server.com/";
- try {
- Server server = MumbleURLParser.parseURL(url);
- assertEquals(server.getHost(), "server.com");
- assertEquals(server.getPort(), Constants.DEFAULT_PORT);
- } catch (MalformedURLException e) {
- fail("Failed to parse URL.");
- }
- }
-
- public void testURLWithPort() {
- String url = "mumble://server.com:5000/";
- try {
- Server server = MumbleURLParser.parseURL(url);
- assertEquals(server.getHost(), "server.com");
- assertEquals(server.getPort(), 5000);
- } catch (MalformedURLException e) {
- fail("Failed to parse URL.");
- }
- }
-
- public void testURLWithUsername() {
- String url = "mumble://TestUser@server.com/";
- try {
- Server server = MumbleURLParser.parseURL(url);
- assertEquals(server.getHost(), "server.com");
- assertEquals(server.getUsername(), "TestUser");
- assertEquals(server.getPort(), Constants.DEFAULT_PORT);
- } catch (MalformedURLException e) {
- fail("Failed to parse URL.");
- }
- }
-
- public void testURLWithCredentials() {
- String url = "mumble://TestUser:mypassword@server.com:5000/";
- try {
- Server server = MumbleURLParser.parseURL(url);
- assertEquals(server.getHost(), "server.com");
- assertEquals(server.getUsername(), "TestUser");
- assertEquals(server.getPassword(), "mypassword");
- assertEquals(server.getPort(), 5000);
- } catch (MalformedURLException e) {
- fail("Failed to parse URL.");
- }
- }
-
- public void testURLWithPassword() {
- String url = "mumble://:mypassword@server.com/";
- try {
- Server server = MumbleURLParser.parseURL(url);
- assertEquals(server.getHost(), "server.com");
- assertEquals(server.getPassword(), "mypassword");
- assertEquals(server.getPort(), Constants.DEFAULT_PORT);
- } catch (MalformedURLException e) {
- fail("Failed to parse URL.");
- }
- }
-
- public void testInvalidScheme() {
- String url = "grumble://server.com/";
- try {
- MumbleURLParser.parseURL(url);
- fail("Successfully parsed bad scheme!");
- } catch (MalformedURLException e) {
- e.printStackTrace();
- }
- }
-
-}