Skip to content

Commit

Permalink
Add stereo decoding test case
Browse files Browse the repository at this point in the history
Couple more sample files added
  • Loading branch information
mcraiha committed Nov 18, 2024
1 parent 530c470 commit 3d8badd
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 1 deletion.
28 changes: 27 additions & 1 deletion tests/DecodeTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public void Setup()
}

[Test, Description("Decode an existing mono 48 000 Hz QOA audio file")]
public void Decode48000HzMonoQOA()
public void Decode_48000_Hz_Mono_QOA()
{
// Arrange
string input_WAV_Filename = "samples/car_trunk_close.qoa.wav";
Expand All @@ -34,4 +34,30 @@ public void Decode48000HzMonoQOA()
// Assert
Assert.That(actual, Is.EqualTo(expected).AsCollection);
}

[Test, Description("Decode an existing stereo 48 000 Hz QOA audio file")]
public void Decode_48000_Hz_Stereo_QOA()
{
// Arrange
string input_WAV_Filename = "samples/sting_xp_level_up_orch_01.qoa.wav";
byte[] expected = File.ReadAllBytes(input_WAV_Filename);

string input_QOA_Filename = "samples/sting_xp_level_up_orch_01.qoa";

QOA.QOA qoa = new QOA.QOA();

// Act
byte[]? actual = null;
using (FileStream inputStream = File.OpenRead(input_QOA_Filename))
{
using (MemoryStream decodedStream = new MemoryStream())
{
qoa.DecodeToWav(inputStream, decodedStream);
actual = decodedStream.ToArray();
}
}

// Assert
Assert.That(actual, Is.EqualTo(expected).AsCollection);
}
}
3 changes: 3 additions & 0 deletions tests/samples/sting_xp_level_up_orch_01.qoa
Git LFS file not shown
3 changes: 3 additions & 0 deletions tests/samples/sting_xp_level_up_orch_01.qoa.wav
Git LFS file not shown
2 changes: 2 additions & 0 deletions tests/tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@
<None Update="samples/car_trunk_close.qoa.wav" CopyToOutputDirectory="PreserveNewest" />

<None Update="samples/sting_xp_level_up_orch_01.wav" CopyToOutputDirectory="PreserveNewest" />
<None Update="samples/sting_xp_level_up_orch_01.qoa" CopyToOutputDirectory="PreserveNewest" />
<None Update="samples/sting_xp_level_up_orch_01.qoa.wav" CopyToOutputDirectory="PreserveNewest" />
</ItemGroup>

</Project>

0 comments on commit 3d8badd

Please sign in to comment.