mirror of
https://github.com/claunia/cuetools.net.git
synced 2025-12-16 18:14:25 +00:00
97 lines
2.7 KiB
C#
97 lines
2.7 KiB
C#
// 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.");
|
|
}
|
|
|
|
}
|
|
|
|
|
|
}
|