Skip to content

Commit faa6e8e

Browse files
committed
Update tests
1 parent 472f25b commit faa6e8e

File tree

2 files changed

+15
-15
lines changed

2 files changed

+15
-15
lines changed

tests/test_mic_boost.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -156,8 +156,8 @@ void apply_dc_remove_16(int16_t* data, size_t frame_count,
156156
} // anonymous namespace
157157

158158
TEST(DcRemoveTest, RemovesDcOffset) {
159-
// Signal: constant DC of 1000 for 4000 samples (mono)
160-
const size_t N = 4000;
159+
// Signal: constant DC of 1000 — need enough samples for IIR to converge
160+
const size_t N = 8000;
161161
std::vector<int16_t> data(N, 1000);
162162
std::vector<double> px(1, 0.0), py(1, 0.0);
163163

@@ -229,8 +229,8 @@ TEST(DcRemoveTest, SilencePassesThrough) {
229229
}
230230

231231
TEST(DcRemoveTest, StereoIndependentChannels) {
232-
// Ch0: DC offset 2000, Ch1: zero
233-
const size_t frames = 2000;
232+
// Ch0: DC offset 2000, Ch1: zero — need enough frames for IIR convergence
233+
const size_t frames = 8000;
234234
std::vector<int16_t> data(frames * 2);
235235
for (size_t f = 0; f < frames; ++f) {
236236
data[f * 2 + 0] = 2000; // ch0

tests/test_ring_buffer.cpp

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
using namespace audio_daemon;
77

88
TEST(RingBufferTest, Construction) {
9-
RingBuffer rb(4800, 1, 2);
10-
EXPECT_EQ(rb.capacity_frames(), 4800u);
9+
RingBuffer rb(4096, 1, 2);
10+
EXPECT_EQ(rb.capacity_frames(), 4096u);
1111
EXPECT_EQ(rb.channels(), 1);
1212
EXPECT_EQ(rb.available_frames(), 0u);
1313
}
@@ -29,21 +29,21 @@ TEST(RingBufferTest, WriteAndRead) {
2929
}
3030

3131
TEST(RingBufferTest, WrapAround) {
32-
RingBuffer rb(10, 1, 2);
32+
RingBuffer rb(8, 1, 2);
3333

34-
// Write 15 frames into a 10-frame buffer
34+
// Write 15 frames into an 8-frame buffer
3535
std::vector<int16_t> data(15);
3636
std::iota(data.begin(), data.end(), 1); // 1..15
3737
rb.write(reinterpret_cast<const uint8_t*>(data.data()), 15);
3838

39-
EXPECT_EQ(rb.available_frames(), 10u);
39+
EXPECT_EQ(rb.available_frames(), 8u);
4040

41-
// Should contain the last 10 values: 6..15
42-
std::vector<int16_t> out(10);
43-
size_t read = rb.read(reinterpret_cast<uint8_t*>(out.data()), 0, 10);
44-
EXPECT_EQ(read, 10u);
45-
EXPECT_EQ(out[0], 6);
46-
EXPECT_EQ(out[9], 15);
41+
// Should contain the last 8 values: 8..15
42+
std::vector<int16_t> out(8);
43+
size_t read = rb.read(reinterpret_cast<uint8_t*>(out.data()), 0, 8);
44+
EXPECT_EQ(read, 8u);
45+
EXPECT_EQ(out[0], 8);
46+
EXPECT_EQ(out[7], 15);
4747
}
4848

4949
TEST(RingBufferTest, StereoChannels) {

0 commit comments

Comments
 (0)