mirror of
https://github.com/claunia/cuetools.net.git
synced 2025-12-16 18:14:25 +00:00
reorganizing a bit
This commit is contained in:
103
CUETools/CUETools.TestCodecs/ALACWriterTest.cs
Normal file
103
CUETools/CUETools.TestCodecs/ALACWriterTest.cs
Normal file
@@ -0,0 +1,103 @@
|
||||
// The following code was generated by Microsoft Visual Studio 2005.
|
||||
// The test owner should check each test for validity.
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using System;
|
||||
using System.Text;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using CUETools.Codecs;
|
||||
using CUETools.Codecs.ALAC;
|
||||
namespace CUETools.TestCodecs
|
||||
{
|
||||
/// <summary>
|
||||
///This is a test class for CUETools.Codecs.ALAC.ALACWriter and is intended
|
||||
///to contain all CUETools.Codecs.ALAC.ALACWriter Unit Tests
|
||||
///</summary>
|
||||
[TestClass()]
|
||||
public class ALACWriterTest
|
||||
{
|
||||
|
||||
|
||||
private TestContext testContextInstance;
|
||||
|
||||
/// <summary>
|
||||
///Gets or sets the test context which provides
|
||||
///information about and functionality for the current test run.
|
||||
///</summary>
|
||||
public TestContext TestContext
|
||||
{
|
||||
get
|
||||
{
|
||||
return testContextInstance;
|
||||
}
|
||||
set
|
||||
{
|
||||
testContextInstance = value;
|
||||
}
|
||||
}
|
||||
#region Additional test attributes
|
||||
//
|
||||
//You can use the following additional attributes as you write your tests:
|
||||
//
|
||||
//Use ClassInitialize to run code before running the first test in the class
|
||||
//
|
||||
//[ClassInitialize()]
|
||||
//public static void MyClassInitialize(TestContext testContext)
|
||||
//{
|
||||
//}
|
||||
//
|
||||
//Use ClassCleanup to run code after all tests in a class have run
|
||||
//
|
||||
//[ClassCleanup()]
|
||||
//public static void MyClassCleanup()
|
||||
//{
|
||||
//}
|
||||
//
|
||||
//Use TestInitialize to run code before running each test
|
||||
//
|
||||
//[TestInitialize()]
|
||||
//public void MyTestInitialize()
|
||||
//{
|
||||
//}
|
||||
//
|
||||
//Use TestCleanup to run code after each test has run
|
||||
//
|
||||
//[TestCleanup()]
|
||||
//public void MyTestCleanup()
|
||||
//{
|
||||
//}
|
||||
//
|
||||
#endregion
|
||||
|
||||
|
||||
/// <summary>
|
||||
///A test for ALACWriter (string, int, int, int, Stream)
|
||||
///</summary>
|
||||
[TestMethod()]
|
||||
public void ConstructorTest()
|
||||
{
|
||||
AudioBuffer buff = WAVReader.ReadAllSamples("test.wav", null);
|
||||
ALACWriter target;
|
||||
|
||||
target = new ALACWriter("alacwriter0.m4a", null, buff.PCM);
|
||||
target.PaddingLength = 1;
|
||||
target.Vendor = "CUETools";
|
||||
target.CreationTime = DateTime.Parse("15 Aug 1976");
|
||||
target.Write(buff);
|
||||
target.Close();
|
||||
CollectionAssert.AreEqual(File.ReadAllBytes("alac.m4a"), File.ReadAllBytes("alacwriter0.m4a"), "alacwriter0.m4a doesn't match.");
|
||||
|
||||
target = new ALACWriter("alacwriter1.m4a", null, buff.PCM);
|
||||
target.PaddingLength = 1;
|
||||
target.Vendor = "CUETools";
|
||||
target.CreationTime = DateTime.Parse("15 Aug 1976");
|
||||
target.FinalSampleCount = buff.Length;
|
||||
target.Write(buff);
|
||||
target.Close();
|
||||
CollectionAssert.AreEqual(File.ReadAllBytes("alac.m4a"), File.ReadAllBytes("alacwriter1.m4a"), "alacwriter1.m4a doesn't match.");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
96
CUETools/CUETools.TestCodecs/AccurateRipTest.cs
Normal file
96
CUETools/CUETools.TestCodecs/AccurateRipTest.cs
Normal file
@@ -0,0 +1,96 @@
|
||||
// The following code was generated by Microsoft Visual Studio 2005.
|
||||
// The test owner should check each test for validity.
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using System;
|
||||
using System.Text;
|
||||
using System.Collections.Generic;
|
||||
using CUETools.CDImage;
|
||||
using CUETools.AccurateRip;
|
||||
using CUETools.Codecs;
|
||||
namespace CUETools.TestCodecs
|
||||
{
|
||||
/// <summary>
|
||||
///This is a test class for CUETools.AccurateRip.AccurateRipVerify and is intended
|
||||
///to contain all CUETools.AccurateRip.AccurateRipVerify Unit Tests
|
||||
///</summary>
|
||||
[TestClass()]
|
||||
public class AccurateRipVerifyTest
|
||||
{
|
||||
|
||||
|
||||
private TestContext testContextInstance;
|
||||
|
||||
private int[,] testSamples = new int[,] { { 0, 0 }, { -2, -3 }, { 32767, 32766 }, { -32765, -32764 } };
|
||||
|
||||
/// <summary>
|
||||
///Gets or sets the test context which provides
|
||||
///information about and functionality for the current test run.
|
||||
///</summary>
|
||||
public TestContext TestContext
|
||||
{
|
||||
get
|
||||
{
|
||||
return testContextInstance;
|
||||
}
|
||||
set
|
||||
{
|
||||
testContextInstance = value;
|
||||
}
|
||||
}
|
||||
#region Additional test attributes
|
||||
//
|
||||
//You can use the following additional attributes as you write your tests:
|
||||
//
|
||||
//Use ClassInitialize to run code before running the first test in the class
|
||||
//
|
||||
//[ClassInitialize()]
|
||||
//public static void MyClassInitialize(TestContext testContext)
|
||||
//{
|
||||
//}
|
||||
//
|
||||
//Use ClassCleanup to run code after all tests in a class have run
|
||||
//
|
||||
//[ClassCleanup()]
|
||||
//public static void MyClassCleanup()
|
||||
//{
|
||||
//}
|
||||
//
|
||||
//Use TestInitialize to run code before running each test
|
||||
//
|
||||
//[TestInitialize()]
|
||||
//public void MyTestInitialize()
|
||||
//{
|
||||
//}
|
||||
//
|
||||
//Use TestCleanup to run code after each test has run
|
||||
//
|
||||
//[TestCleanup()]
|
||||
//public void MyTestCleanup()
|
||||
//{
|
||||
//}
|
||||
//
|
||||
#endregion
|
||||
|
||||
|
||||
/// <summary>
|
||||
///A test for CalculateCRCs (AudioBuffer, int, int)
|
||||
///</summary>
|
||||
[TestMethod()]
|
||||
public void CalculateCRCsTest()
|
||||
{
|
||||
CDImageLayout toc = new CDImageLayout();
|
||||
toc.AddTrack(new CDTrack(1, 0, 10, true, false));
|
||||
AccurateRipVerify target = new AccurateRipVerify(toc);
|
||||
AudioBuffer buff = new AudioBuffer(AudioPCMConfig.RedBook, testSamples, testSamples.GetLength(0));
|
||||
target.CalculateCRCs(buff, 0, testSamples.GetLength(0));
|
||||
Crc32 crc32 = new Crc32();
|
||||
uint crc1 = crc32.ComputeChecksum(0xffffffff, buff.Bytes, 0, buff.ByteLength) ^ 0xffffffff;
|
||||
Assert.AreEqual<uint>(3856971150, crc1, "CRC32 was not set correctly.");
|
||||
Assert.AreEqual<uint>(3856971150, target.CRC32(0), "CRC32 was not set correctly.");
|
||||
Assert.AreEqual<uint>(1921661108, target.CRCWONULL(0), "CRC32WONULL was not set correctly.");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
67
CUETools/CUETools.TestCodecs/CUETools.TestCodecs.csproj
Normal file
67
CUETools/CUETools.TestCodecs/CUETools.TestCodecs.csproj
Normal file
@@ -0,0 +1,67 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProductVersion>8.0.50727</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{04945FB2-8410-4F14-8262-2ED18DCDACD6}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<RootNamespace>CUETools.TestCodecs</RootNamespace>
|
||||
<AssemblyName>CUETools.TestCodecs</AssemblyName>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>.\bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugSymbols>false</DebugSymbols>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>.\bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\..\Windows\assembly\GAC_MSIL\Microsoft.VisualStudio.QualityTools.UnitTestFramework\8.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="AccurateRipTest.cs" />
|
||||
<Compile Include="ALACWriterTest.cs" />
|
||||
<Compile Include="CodecsTest.cs" />
|
||||
<Compile Include="FlakeWriterTest.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\CUETools.AccurateRip\CUETools.AccurateRip.csproj">
|
||||
<Project>{5802C7E9-157E-4124-946D-70B5AE48A5A1}</Project>
|
||||
<Name>CUETools.AccurateRip</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\CUETools.CDImage\CUETools.CDImage.csproj">
|
||||
<Project>{1DD41038-D885-46C5-8DDE-E0B82F066584}</Project>
|
||||
<Name>CUETools.CDImage</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\CUETools.Codecs.ALAC\CUETools.Codecs.ALAC.csproj">
|
||||
<Project>{F2EC7193-D5E5-4252-9803-5CEB407E910F}</Project>
|
||||
<Name>CUETools.Codecs.ALAC</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\CUETools.Codecs.FLAKE\CUETools.Codecs.FLAKE.csproj">
|
||||
<Project>{082D6B9E-326E-4D15-9798-EDAE9EDE70A6}</Project>
|
||||
<Name>CUETools.Codecs.FLAKE</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\CUETools.Codecs\CUETools.Codecs.csproj">
|
||||
<Project>{6458A13A-30EF-45A9-9D58-E5031B17BEE2}</Project>
|
||||
<Name>CUETools.Codecs</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSHARP.Targets" />
|
||||
</Project>
|
||||
345
CUETools/CUETools.TestCodecs/CodecsTest.cs
Normal file
345
CUETools/CUETools.TestCodecs/CodecsTest.cs
Normal file
@@ -0,0 +1,345 @@
|
||||
// The following code was generated by Microsoft Visual Studio 2005.
|
||||
// The test owner should check each test for validity.
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using System;
|
||||
using System.Text;
|
||||
using System.Collections.Generic;
|
||||
using CUETools.Codecs;
|
||||
using System.IO;
|
||||
|
||||
namespace CUETools.TestCodecs
|
||||
{
|
||||
/// <summary>
|
||||
///This is a test class for CUETools.Codecs.AudioBuffer and is intended
|
||||
///to contain all CUETools.Codecs.AudioBuffer Unit Tests
|
||||
///</summary>
|
||||
[TestClass()]
|
||||
public class AudioBufferTest
|
||||
{
|
||||
|
||||
|
||||
private TestContext testContextInstance;
|
||||
|
||||
private int[,] testSamples = new int[,] { { 0, 1 }, { -2, -3 }, { 32767, 32766 }, { -32765, -32764 } };
|
||||
private byte[] testBytes = new byte[] { 0, 0, 1, 0, 254, 255, 253, 255, 255, 127, 254, 127, 3, 128, 4, 128 };
|
||||
|
||||
private int[,] testSamples2 = new int[,] { { 0, 1 }, { -2, -3 }, { 32767, 32766 }, { -32765, -32764 }, { 42, 42 } };
|
||||
private byte[] testBytes2 = new byte[] { 0, 0, 1, 0, 254, 255, 253, 255, 255, 127, 254, 127, 3, 128, 4, 128, 42, 0, 42, 0 };
|
||||
|
||||
/// <summary>
|
||||
///Gets or sets the test context which provides
|
||||
///information about and functionality for the current test run.
|
||||
///</summary>
|
||||
public TestContext TestContext
|
||||
{
|
||||
get
|
||||
{
|
||||
return testContextInstance;
|
||||
}
|
||||
set
|
||||
{
|
||||
testContextInstance = value;
|
||||
}
|
||||
}
|
||||
#region Additional test attributes
|
||||
//
|
||||
//You can use the following additional attributes as you write your tests:
|
||||
//
|
||||
//Use ClassInitialize to run code before running the first test in the class
|
||||
//
|
||||
//[ClassInitialize()]
|
||||
//public static void MyClassInitialize(TestContext testContext)
|
||||
//{
|
||||
//}
|
||||
//
|
||||
//Use ClassCleanup to run code after all tests in a class have run
|
||||
//
|
||||
//[ClassCleanup()]
|
||||
//public static void MyClassCleanup()
|
||||
//{
|
||||
//}
|
||||
//
|
||||
//Use TestInitialize to run code before running each test
|
||||
//
|
||||
//[TestInitialize()]
|
||||
//public void MyTestInitialize()
|
||||
//{
|
||||
//}
|
||||
//
|
||||
//Use TestCleanup to run code after each test has run
|
||||
//
|
||||
//[TestCleanup()]
|
||||
//public void MyTestCleanup()
|
||||
//{
|
||||
//}
|
||||
//
|
||||
#endregion
|
||||
|
||||
|
||||
/// <summary>
|
||||
///A test for Bytes
|
||||
///</summary>
|
||||
[TestMethod()]
|
||||
public void BytesTest()
|
||||
{
|
||||
AudioBuffer target = new AudioBuffer(AudioPCMConfig.RedBook, 1);
|
||||
target.Prepare(testSamples, testSamples.GetLength(0));
|
||||
CollectionAssert.AreEqual(testBytes, target.Bytes, "CUETools.Codecs.AudioBuffer.Bytes was not set correctly.");
|
||||
target.Prepare(testSamples2, testSamples2.GetLength(0));
|
||||
CollectionAssert.AreEqual(testBytes2, target.Bytes, "CUETools.Codecs.AudioBuffer.Bytes was not set correctly.");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///A test for Samples
|
||||
///</summary>
|
||||
[TestMethod()]
|
||||
public void SamplesTest()
|
||||
{
|
||||
AudioBuffer target = new AudioBuffer(AudioPCMConfig.RedBook, 1);
|
||||
target.Prepare(testBytes, testSamples.GetLength(0));
|
||||
CollectionAssert.AreEqual(testSamples, target.Samples, "CUETools.Codecs.AudioBuffer.Samples was not set correctly.");
|
||||
target.Prepare(testBytes2, testSamples2.GetLength(0));
|
||||
CollectionAssert.AreEqual(testSamples2, target.Samples, "CUETools.Codecs.AudioBuffer.Samples was not set correctly.");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
///This is a test class for CUETools.Codecs.WAVReader and is intended
|
||||
///to contain all CUETools.Codecs.WAVReader Unit Tests
|
||||
///</summary>
|
||||
[TestClass()]
|
||||
public class WAVReaderTest
|
||||
{
|
||||
|
||||
|
||||
private TestContext testContextInstance;
|
||||
private WAVReader pipe = null;
|
||||
private WAVReader wave = null;
|
||||
|
||||
public readonly static int[,] pipeSamples = new int[,] { { -1, 1 }, { 0, -1 }, { -1, 0 }, { 0, -1 }, { -1, -1 }, { -1, -1 }, { 1, 0 }, { -3, -2 }, { 3, 1 }, { -4, -3 }, { 3, 2 }, { -4, -3 }, { 3, 1 }, { -3, -1 }, { 1, -1 }, { -1, 1 }, { -1, -3 }, { 0, 3 }, { -2, -4 }, { 0, 3 }, { -1, -4 }, { -1, 3 }, { 0, -3 }, { -2, 1 }, { 1, -1 }, { -2, -1 }, { 0, 1 }, { -1, -2 }, { -1, 1 }, { 1, -2 }, { -3, 1 }, { 3, -2 }, { -4, 0 }, { 3, -1 }, { -4, -1 }, { 3, -1 }, { -3, 0 }, { 1, -1 }, { -1, 1 }, { -1, -2 }, { 0, 2 }, { -1, -3 }, { 0, 2 }, { 0, -3 }, { -1, 1 }, { 1, -1 }, { -2, -1 }, { 2, 1 }, { -2, -3 }, { 1, 3 }, { -1, -4 }, { -1, 3 }, { 1, -4 }, { 0, 0 } };
|
||||
public readonly static int[,] testSamples = new int[,] { { -1, 1 }, { 0, -1 }, { -1, 0 }, { 0, -1 }, { -1, -1 }, { -1, -1 }, { 1, 0 }, { -3, -2 }, { 3, 1 }, { -4, -3 }, { 3, 2 }, { -4, -3 }, { 3, 1 }, { -3, -1 }, { 1, -1 }, { -1, 1 }, { -1, -3 }, { 0, 3 }, { -2, -4 }, { 0, 3 }, { -1, -4 }, { -1, 3 }, { 0, -3 }, { -2, 1 }, { 1, -1 }, { -2, -1 }, { 0, 1 }, { -1, -2 }, { -1, 1 }, { 1, -2 }, { -3, 1 }, { 3, -2 }, { -4, 0 }, { 3, -1 }, { -4, -1 }, { 3, -1 }, { -3, 0 }, { 1, -1 }, { -1, 1 }, { -1, -2 }, { 0, 2 }, { -1, -3 }, { 0, 2 }, { 0, -3 }, { -1, 1 }, { 1, -1 }, { -2, -1 }, { 2, 1 }, { -2, -3 }, { 1, 3 }, { -1, -4 }, { -1, 3 }, { 1, -4 }};
|
||||
|
||||
/// <summary>
|
||||
///Gets or sets the test context which provides
|
||||
///information about and functionality for the current test run.
|
||||
///</summary>
|
||||
public TestContext TestContext
|
||||
{
|
||||
get
|
||||
{
|
||||
return testContextInstance;
|
||||
}
|
||||
set
|
||||
{
|
||||
testContextInstance = value;
|
||||
}
|
||||
}
|
||||
#region Additional test attributes
|
||||
//
|
||||
//You can use the following additional attributes as you write your tests:
|
||||
//
|
||||
//Use ClassInitialize to run code before running the first test in the class
|
||||
//
|
||||
[ClassInitialize()]
|
||||
public static void MyClassInitialize(TestContext testContext)
|
||||
{
|
||||
}
|
||||
|
||||
//
|
||||
//Use ClassCleanup to run code after all tests in a class have run
|
||||
//
|
||||
[ClassCleanup()]
|
||||
public static void MyClassCleanup()
|
||||
{
|
||||
}
|
||||
//
|
||||
//Use TestInitialize to run code before running each test
|
||||
//
|
||||
[TestInitialize()]
|
||||
public void MyTestInitialize()
|
||||
{
|
||||
pipe = new WAVReader("pipe.wav", null);
|
||||
wave = new WAVReader("test.wav", null);
|
||||
}
|
||||
//
|
||||
//Use TestCleanup to run code after each test has run
|
||||
//
|
||||
[TestCleanup()]
|
||||
public void MyTestCleanup()
|
||||
{
|
||||
pipe.Close();
|
||||
pipe = null;
|
||||
wave.Close();
|
||||
wave = null;
|
||||
}
|
||||
//
|
||||
#endregion
|
||||
|
||||
private void DumpSamples(int[,] samples)
|
||||
{
|
||||
StringWriter sw = new StringWriter();
|
||||
for (int i = 0; i < samples.GetLength(0); i++)
|
||||
sw.Write(" {0}{1}, {2}{3},", "{", samples[i, 0], samples[i, 1], "}");
|
||||
TestContext.WriteLine("{0}", sw.ToString());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///A test for Read (AudioBuffer, int)
|
||||
///</summary>
|
||||
[TestMethod()]
|
||||
public void ReadTest()
|
||||
{
|
||||
Assert.AreEqual(-1L, pipe.Length, "CUETools.Codecs.WAVReader.Length did not return the expected value.");
|
||||
AudioBuffer buff = new AudioBuffer(pipe, 54);
|
||||
int actual = pipe.Read(buff, -1);
|
||||
Assert.AreEqual(53, actual, "CUETools.Codecs.WAVReader.Read did not return the expected value.");
|
||||
Assert.AreEqual(actual, buff.Length, "CUETools.Codecs.WAVReader.Read did not return the expected value.");
|
||||
CollectionAssert.AreEqual(pipeSamples, buff.Samples, "AudioBuffer.Samples was not set correctly.");
|
||||
actual = pipe.Read(buff, -1);
|
||||
Assert.AreEqual(0, actual, "CUETools.Codecs.WAVReader.Read did not return the expected value.");
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
///A test for BitsPerSample
|
||||
///</summary>
|
||||
[TestMethod()]
|
||||
public void BitsPerSampleTest()
|
||||
{
|
||||
Assert.AreEqual(16, pipe.PCM.BitsPerSample, "CUETools.Codecs.WAVReader.BitsPerSample was not set correctly.");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///A test for BlockAlign
|
||||
///</summary>
|
||||
[TestMethod()]
|
||||
public void BlockAlignTest()
|
||||
{
|
||||
Assert.AreEqual(4, pipe.PCM.BlockAlign, "CUETools.Codecs.WAVReader.BlockAlign was not set correctly.");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///A test for ChannelCount
|
||||
///</summary>
|
||||
[TestMethod()]
|
||||
public void ChannelCountTest()
|
||||
{
|
||||
Assert.AreEqual(2, pipe.PCM.ChannelCount, "CUETools.Codecs.WAVReader.ChannelCount was not set correctly.");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///A test for Length
|
||||
///</summary>
|
||||
[TestMethod()]
|
||||
public void LengthTest()
|
||||
{
|
||||
Assert.AreEqual(-1L, pipe.Length, "CUETools.Codecs.WAVReader.Length was not set correctly.");
|
||||
Assert.AreEqual(53L, wave.Length, "CUETools.Codecs.WAVReader.Length was not set correctly.");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///A test for SampleRate
|
||||
///</summary>
|
||||
[TestMethod()]
|
||||
public void SampleRateTest()
|
||||
{
|
||||
Assert.AreEqual(44100, pipe.PCM.SampleRate, "CUETools.Codecs.WAVReader.SampleRate was not set correctly.");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///A test for ReadAllSamples (string, Stream)
|
||||
///</summary>
|
||||
[TestMethod()]
|
||||
public void ReadAllSamplesTest()
|
||||
{
|
||||
AudioBuffer buff = WAVReader.ReadAllSamples("test.wav", null);
|
||||
CollectionAssert.AreEqual(testSamples, buff.Samples, "AudioBuffer.Samples was not set correctly.");
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
///This is a test class for CUETools.Codecs.WAVWriter and is intended
|
||||
///to contain all CUETools.Codecs.WAVWriter Unit Tests
|
||||
///</summary>
|
||||
[TestClass()]
|
||||
public class WAVWriterTest
|
||||
{
|
||||
|
||||
|
||||
private TestContext testContextInstance;
|
||||
|
||||
/// <summary>
|
||||
///Gets or sets the test context which provides
|
||||
///information about and functionality for the current test run.
|
||||
///</summary>
|
||||
public TestContext TestContext
|
||||
{
|
||||
get
|
||||
{
|
||||
return testContextInstance;
|
||||
}
|
||||
set
|
||||
{
|
||||
testContextInstance = value;
|
||||
}
|
||||
}
|
||||
#region Additional test attributes
|
||||
//
|
||||
//You can use the following additional attributes as you write your tests:
|
||||
//
|
||||
//Use ClassInitialize to run code before running the first test in the class
|
||||
//
|
||||
//[ClassInitialize()]
|
||||
//public static void MyClassInitialize(TestContext testContext)
|
||||
//{
|
||||
//}
|
||||
//
|
||||
//Use ClassCleanup to run code after all tests in a class have run
|
||||
//
|
||||
//[ClassCleanup()]
|
||||
//public static void MyClassCleanup()
|
||||
//{
|
||||
//}
|
||||
//
|
||||
//Use TestInitialize to run code before running each test
|
||||
//
|
||||
//[TestInitialize()]
|
||||
//public void MyTestInitialize()
|
||||
//{
|
||||
//}
|
||||
//
|
||||
//Use TestCleanup to run code after each test has run
|
||||
//
|
||||
//[TestCleanup()]
|
||||
//public void MyTestCleanup()
|
||||
//{
|
||||
//}
|
||||
//
|
||||
#endregion
|
||||
|
||||
|
||||
/// <summary>
|
||||
///A test for WAVWriter (string, int, int, int, Stream)
|
||||
///</summary>
|
||||
[TestMethod()]
|
||||
public void ConstructorTest()
|
||||
{
|
||||
AudioBuffer buff = WAVReader.ReadAllSamples("test.wav", null);
|
||||
WAVWriter target;
|
||||
|
||||
target = new WAVWriter("wavwriter0.wav", null, buff.PCM);
|
||||
//target.FinalSampleCount = buff.Length;
|
||||
target.Write(buff);
|
||||
target.Close();
|
||||
CollectionAssert.AreEqual(File.ReadAllBytes("test.wav"), File.ReadAllBytes("wavwriter0.wav"), "wavwriter0.wav doesn't match.");
|
||||
|
||||
target = new WAVWriter("wavwriter1.wav", null, buff.PCM);
|
||||
target.FinalSampleCount = buff.Length;
|
||||
target.Write(buff);
|
||||
target.Close();
|
||||
CollectionAssert.AreEqual(File.ReadAllBytes("test.wav"), File.ReadAllBytes("wavwriter1.wav"), "wavwriter1.wav doesn't match.");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
105
CUETools/CUETools.TestCodecs/FlakeWriterTest.cs
Normal file
105
CUETools/CUETools.TestCodecs/FlakeWriterTest.cs
Normal file
@@ -0,0 +1,105 @@
|
||||
// The following code was generated by Microsoft Visual Studio 2005.
|
||||
// The test owner should check each test for validity.
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using System;
|
||||
using System.Text;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using CUETools.Codecs;
|
||||
using CUETools.Codecs.FLAKE;
|
||||
namespace CUETools.TestCodecs
|
||||
{
|
||||
/// <summary>
|
||||
///This is a test class for CUETools.Codecs.FLAKE.FlakeWriter and is intended
|
||||
///to contain all CUETools.Codecs.FLAKE.FlakeWriter Unit Tests
|
||||
///</summary>
|
||||
[TestClass()]
|
||||
public class FlakeWriterTest
|
||||
{
|
||||
|
||||
|
||||
private TestContext testContextInstance;
|
||||
|
||||
/// <summary>
|
||||
///Gets or sets the test context which provides
|
||||
///information about and functionality for the current test run.
|
||||
///</summary>
|
||||
public TestContext TestContext
|
||||
{
|
||||
get
|
||||
{
|
||||
return testContextInstance;
|
||||
}
|
||||
set
|
||||
{
|
||||
testContextInstance = value;
|
||||
}
|
||||
}
|
||||
#region Additional test attributes
|
||||
//
|
||||
//You can use the following additional attributes as you write your tests:
|
||||
//
|
||||
//Use ClassInitialize to run code before running the first test in the class
|
||||
//
|
||||
//[ClassInitialize()]
|
||||
//public static void MyClassInitialize(TestContext testContext)
|
||||
//{
|
||||
//}
|
||||
//
|
||||
//Use ClassCleanup to run code after all tests in a class have run
|
||||
//
|
||||
//[ClassCleanup()]
|
||||
//public static void MyClassCleanup()
|
||||
//{
|
||||
//}
|
||||
//
|
||||
//Use TestInitialize to run code before running each test
|
||||
//
|
||||
//[TestInitialize()]
|
||||
//public void MyTestInitialize()
|
||||
//{
|
||||
//}
|
||||
//
|
||||
//Use TestCleanup to run code after each test has run
|
||||
//
|
||||
//[TestCleanup()]
|
||||
//public void MyTestCleanup()
|
||||
//{
|
||||
//}
|
||||
//
|
||||
#endregion
|
||||
|
||||
|
||||
/// <summary>
|
||||
///A test for FlakeWriter (string, int, int, int, Stream)
|
||||
///</summary>
|
||||
[TestMethod()]
|
||||
public void ConstructorTest()
|
||||
{
|
||||
AudioBuffer buff = WAVReader.ReadAllSamples("test.wav", null);
|
||||
FlakeWriter target;
|
||||
|
||||
target = new FlakeWriter("flakewriter0.flac", null, buff.PCM);
|
||||
target.PaddingLength = 1;
|
||||
target.DoSeekTable = false;
|
||||
//target.Vendor = "CUETools";
|
||||
//target.CreationTime = DateTime.Parse("15 Aug 1976");
|
||||
target.FinalSampleCount = buff.Length;
|
||||
target.Write(buff);
|
||||
target.Close();
|
||||
CollectionAssert.AreEqual(File.ReadAllBytes("flake.flac"), File.ReadAllBytes("flakewriter0.flac"), "flakewriter0.flac doesn't match.");
|
||||
|
||||
target = new FlakeWriter("flakewriter1.flac", null, buff.PCM);
|
||||
target.PaddingLength = 1;
|
||||
target.DoSeekTable = false;
|
||||
//target.Vendor = "CUETools";
|
||||
//target.CreationTime = DateTime.Parse("15 Aug 1976");
|
||||
target.Write(buff);
|
||||
target.Close();
|
||||
CollectionAssert.AreEqual(File.ReadAllBytes("flake.flac"), File.ReadAllBytes("flakewriter1.flac"), "flakewriter1.flac doesn't match.");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
35
CUETools/CUETools.TestCodecs/Properties/AssemblyInfo.cs
Normal file
35
CUETools/CUETools.TestCodecs/Properties/AssemblyInfo.cs
Normal file
@@ -0,0 +1,35 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("CUETools.TestCodecs")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("Microsoft")]
|
||||
[assembly: AssemblyProduct("CUETools.TestCodecs")]
|
||||
[assembly: AssemblyCopyright("Copyright © Microsoft 2010")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM componenets. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("62e9c766-721e-4dba-8187-f9d87449920e")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Revision and Build Numbers
|
||||
// by using the '*' as shown below:
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
BIN
CUETools/CUETools.TestCodecs/alac.m4a
Normal file
BIN
CUETools/CUETools.TestCodecs/alac.m4a
Normal file
Binary file not shown.
BIN
CUETools/CUETools.TestCodecs/flake.flac
Normal file
BIN
CUETools/CUETools.TestCodecs/flake.flac
Normal file
Binary file not shown.
BIN
CUETools/CUETools.TestCodecs/pipe.wav
Normal file
BIN
CUETools/CUETools.TestCodecs/pipe.wav
Normal file
Binary file not shown.
BIN
CUETools/CUETools.TestCodecs/test.wav
Normal file
BIN
CUETools/CUETools.TestCodecs/test.wav
Normal file
Binary file not shown.
Reference in New Issue
Block a user