From 901bf58c5cf9151942f8c4cd4e1427a02dec4b52 Mon Sep 17 00:00:00 2001 From: Tom Cooks Date: Sat, 10 Oct 2026 15:42:04 -0400 Subject: RECCoon 1.0.0: rebrand to Tom Cooks, Parakeet-only, GPLv3, F-Droid-ready --- .../java/com/tomcooks/reccoon/FormatsTest.java | 20 +++++++++++ .../tomcooks/reccoon/StreamingResamplerTest.java | 41 ++++++++++++++++++++++ .../com/wuhei/reccoon/StreamingResamplerTest.java | 41 ---------------------- 3 files changed, 61 insertions(+), 41 deletions(-) create mode 100644 app/src/test/java/com/tomcooks/reccoon/FormatsTest.java create mode 100644 app/src/test/java/com/tomcooks/reccoon/StreamingResamplerTest.java delete mode 100644 app/src/test/java/com/wuhei/reccoon/StreamingResamplerTest.java (limited to 'app/src/test/java') diff --git a/app/src/test/java/com/tomcooks/reccoon/FormatsTest.java b/app/src/test/java/com/tomcooks/reccoon/FormatsTest.java new file mode 100644 index 0000000..96427a1 --- /dev/null +++ b/app/src/test/java/com/tomcooks/reccoon/FormatsTest.java @@ -0,0 +1,20 @@ +package com.tomcooks.reccoon; + +import static org.junit.Assert.assertEquals; + +import org.junit.Test; + +public class FormatsTest { + + @Test + public void prettyNameStripsWavExtension() { + assertEquals("2026-10-05 09:30:00 #00012", + Formats.prettyName("reccoon-2026-10-05-093000-00012.wav")); + } + + @Test + public void prettyNameStripsM4aExtension() { + assertEquals("2026-10-05 09:30:00 #00012", + Formats.prettyName("reccoon-2026-10-05-093000-00012.m4a")); + } +} diff --git a/app/src/test/java/com/tomcooks/reccoon/StreamingResamplerTest.java b/app/src/test/java/com/tomcooks/reccoon/StreamingResamplerTest.java new file mode 100644 index 0000000..4c44a44 --- /dev/null +++ b/app/src/test/java/com/tomcooks/reccoon/StreamingResamplerTest.java @@ -0,0 +1,41 @@ +package com.tomcooks.reccoon; + +import static org.junit.Assert.assertTrue; + +import org.junit.Test; + +import java.util.Random; + +/** Regression tests for the streaming resampler. */ +public class StreamingResamplerTest { + + @Test + public void longStreamOfFullChunksDoesNotThrow() { + StreamingResampler resampler = new StreamingResampler(44100, 16000); + float[] chunk = new float[8192]; + long total = 0; + for (int i = 0; i < 400; i++) { + for (int j = 0; j < chunk.length; j++) { + chunk[j] = (float) Math.sin((i * 8192 + j) * 0.01); + } + total += resampler.process(chunk).length; + } + assertTrue(total > 1_000_000); + } + + @Test + public void oddChunkSizesDoNotThrow() { + StreamingResampler resampler = new StreamingResampler(44100, 16000); + Random random = new Random(1); + long total = 0; + for (int i = 0; i < 3000; i++) { + int n = 1 + random.nextInt(3000); + float[] chunk = new float[n]; + for (int j = 0; j < n; j++) { + chunk[j] = random.nextFloat() * 2f - 1f; + } + total += resampler.process(chunk).length; + } + assertTrue(total > 0); + } +} diff --git a/app/src/test/java/com/wuhei/reccoon/StreamingResamplerTest.java b/app/src/test/java/com/wuhei/reccoon/StreamingResamplerTest.java deleted file mode 100644 index 6e4cdcd..0000000 --- a/app/src/test/java/com/wuhei/reccoon/StreamingResamplerTest.java +++ /dev/null @@ -1,41 +0,0 @@ -package com.wuhei.reccoon; - -import static org.junit.Assert.assertTrue; - -import org.junit.Test; - -import java.util.Random; - -/** Regression tests for the streaming resampler. */ -public class StreamingResamplerTest { - - @Test - public void longStreamOfFullChunksDoesNotThrow() { - StreamingResampler resampler = new StreamingResampler(44100, 16000); - float[] chunk = new float[8192]; - long total = 0; - for (int i = 0; i < 400; i++) { - for (int j = 0; j < chunk.length; j++) { - chunk[j] = (float) Math.sin((i * 8192 + j) * 0.01); - } - total += resampler.process(chunk).length; - } - assertTrue(total > 1_000_000); - } - - @Test - public void oddChunkSizesDoNotThrow() { - StreamingResampler resampler = new StreamingResampler(44100, 16000); - Random random = new Random(1); - long total = 0; - for (int i = 0; i < 3000; i++) { - int n = 1 + random.nextInt(3000); - float[] chunk = new float[n]; - for (int j = 0; j < n; j++) { - chunk[j] = random.nextFloat() * 2f - 1f; - } - total += resampler.process(chunk).length; - } - assertTrue(total > 0); - } -} -- cgit v1.2.3