Skip to content

Commit

Permalink
Tests: better 'copy' requirements
Browse files Browse the repository at this point in the history
  • Loading branch information
gvnnz committed Mar 30, 2024
1 parent bcd771f commit a459605
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions tests/audioBuffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ void fillBufferWithData(AudioBuffer& b)
});
}

void testCopy(AudioBuffer& b, int sourceBufferSize)
void testCopy(AudioBuffer& a, AudioBuffer& b)
{
REQUIRE(b[0][0] == 0.0f);
REQUIRE(b[16][0] == 16.0f);
REQUIRE(b[128][0] == 128.0f);
REQUIRE(b[1024][0] == 1024.0f);
REQUIRE(b[sourceBufferSize - 1][0] == static_cast<float>(sourceBufferSize - 1));
REQUIRE(a.isAllocd() == true);
REQUIRE(b.isAllocd() == true);
REQUIRE(a.countFrames() == b.countFrames());
REQUIRE(a.countSamples() == b.countSamples());
REQUIRE(a.countChannels() == b.countChannels());
}

void testMove(AudioBuffer& a, AudioBuffer& b, int sourceBufferSize, int sourceNumChannels)
Expand Down Expand Up @@ -108,7 +108,7 @@ TEST_CASE("AudioBuffer")
{
AudioBuffer other(buffer);

testCopy(other, numChannels);
testCopy(buffer, other);
}

SECTION("test full copy with copy assignment")
Expand All @@ -117,7 +117,7 @@ TEST_CASE("AudioBuffer")

other = buffer;

testCopy(other, numChannels);
testCopy(buffer, other);
}

SECTION("test full copy with set()")
Expand All @@ -126,7 +126,7 @@ TEST_CASE("AudioBuffer")

other.set(buffer, 1.0f);

testCopy(other, numChannels);
testCopy(buffer, other);
}
}

Expand Down

0 comments on commit a459605

Please sign in to comment.