diff --git a/CUETools/CUETools.TestCodecs/AccurateRipTest.cs b/CUETools/CUETools.TestCodecs/AccurateRipTest.cs deleted file mode 100644 index 72092cd..0000000 --- a/CUETools/CUETools.TestCodecs/AccurateRipTest.cs +++ /dev/null @@ -1,118 +0,0 @@ -// 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 -{ - /// - ///This is a test class for CUETools.AccurateRip.AccurateRipVerify and is intended - ///to contain all CUETools.AccurateRip.AccurateRipVerify Unit Tests - /// - [TestClass()] - public class AccurateRipVerifyTest - { - - - private TestContext testContextInstance; - - /// - ///Gets or sets the test context which provides - ///information about and functionality for the current test run. - /// - 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 - - - /// - ///A test for CalculateCRCs (AudioBuffer, int, int) - /// - [TestMethod()] - public void CalculateCRCsTest() - { - CDImageLayout toc = new CDImageLayout(); - toc.AddTrack(new CDTrack(1, 03, 20, true, false)); - toc.AddTrack(new CDTrack(2, 23, 20, true, false)); - toc.AddTrack(new CDTrack(3, 43, 20, true, false)); - AccurateRipVerify target = new AccurateRipVerify(toc); - for (int sector = 0; sector < toc.AudioLength; sector++) - { - AudioBuffer buff = new AudioBuffer(AudioPCMConfig.RedBook, 588); - buff.Length = 588; - for (int i = 0; i < buff.Length; i++) - { - buff.Samples[i, 0] = sector * 588 + i; - buff.Samples[i, 1] = sector * 588; - } - target.Write(buff); - } - Assert.AreEqual(3762425816, target.CRC(0), "CRC[0] was not set correctly."); - Assert.AreEqual(3103217968, target.CRC(1), "CRC[1] was not set correctly."); - Assert.AreEqual(3206462296, target.CRC(1, 11), "CRC[1][11] was not set correctly."); - Assert.AreEqual(3068174852, target.CRC(2), "CRC[2] was not set correctly."); - Assert.AreEqual(3233779629, target.CRC32(0), "CRC32[0] was not set correctly."); - Assert.AreEqual(3753760724, target.CRC32(0, 13), "CRC32[0][13] was not set correctly."); - Assert.AreEqual(3153592639, target.CRC32(0, -7), "CRC32[0][-7] was not set correctly."); - Assert.AreEqual(0408974480, target.CRC32(1), "CRC32[1] was not set correctly."); - Assert.AreEqual(4123211700, target.CRC32(2), "CRC32[2] was not set correctly."); - Assert.AreEqual(0297562037, target.CRC32(2, 15), "CRC32[2][15] was not set correctly."); - Assert.AreEqual(0398293317, target.CRC32(2, -1), "CRC32[2][-1] was not set correctly."); - Assert.AreEqual(0564210909, target.CRC32(3), "CRC32[3] was not set correctly."); - Assert.AreEqual(2395016718, target.CRCWONULL(0), "CRC32WONULL[0] was not set correctly."); - Assert.AreEqual(0834934371, target.CRCWONULL(1), "CRC32WONULL[1] was not set correctly."); - Assert.AreEqual(4123211700, target.CRCWONULL(2), "CRC32WONULL[2] was not set correctly."); - Assert.AreEqual(0062860870, target.CRCWONULL(2, 19), "CRC32WONULL[2][19] was not set correctly."); - Assert.AreEqual(0950746738, target.CRCWONULL(2, -2), "CRC32WONULL[2][-2] was not set correctly."); - Assert.AreEqual(0564210909, target.CRCWONULL(3), "CRC32WONULL[3] was not set correctly."); - } - - } - - -} diff --git a/CUETools/CUETools.TestCodecs/AccurateRipVerifyTest.cs b/CUETools/CUETools.TestCodecs/AccurateRipVerifyTest.cs new file mode 100644 index 0000000..f8194dc --- /dev/null +++ b/CUETools/CUETools.TestCodecs/AccurateRipVerifyTest.cs @@ -0,0 +1,159 @@ +// 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 +{ + /// + ///This is a test class for CUETools.AccurateRip.AccurateRipVerify and is intended + ///to contain all CUETools.AccurateRip.AccurateRipVerify Unit Tests + /// + [TestClass()] + public class AccurateRipVerifyTest + { + + + private TestContext testContextInstance; + private CDImageLayout toc; + private AccurateRipVerify ar; + + /// + ///Gets or sets the test context which provides + ///information about and functionality for the current test run. + /// + 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() + { + toc = new CDImageLayout(); + toc.AddTrack(new CDTrack(1, 03, 20, true, false)); + toc.AddTrack(new CDTrack(2, 23, 20, true, false)); + toc.AddTrack(new CDTrack(3, 43, 20, true, false)); + ar = new AccurateRipVerify(toc); + for (int sector = 0; sector < toc.AudioLength; sector++) + { + AudioBuffer buff = new AudioBuffer(AudioPCMConfig.RedBook, 588); + buff.Length = 588; + for (int i = 0; i < buff.Length; i++) + { + buff.Samples[i, 0] = sector * 588 + i; + buff.Samples[i, 1] = sector * 588; + } + ar.Write(buff); + } + } + + //Use TestCleanup to run code after each test has run + // + //[TestCleanup()] + //public void MyTestCleanup() + //{ + //} + // + #endregion + + + /// + ///A test for CRC32 + /// + [TestMethod()] + public void CRC32Test() + { + Assert.AreEqual(3233779629, ar.CRC32(0), "CRC32[0] was not set correctly."); + Assert.AreEqual(0408974480, ar.CRC32(1), "CRC32[1] was not set correctly."); + Assert.AreEqual(4123211700, ar.CRC32(2), "CRC32[2] was not set correctly."); + Assert.AreEqual(0564210909, ar.CRC32(3), "CRC32[3] was not set correctly."); + } + + /// + ///A test for CRC32 + /// + [TestMethod()] + public void CRC32Test1() + { + Assert.AreEqual(3753760724, ar.CRC32(0, 13), "CRC32[0][13] was not set correctly."); + Assert.AreEqual(3153592639, ar.CRC32(0, -7), "CRC32[0][-7] was not set correctly."); + Assert.AreEqual(0297562037, ar.CRC32(2, 15), "CRC32[2][15] was not set correctly."); + Assert.AreEqual(0398293317, ar.CRC32(2, -1), "CRC32[2][-1] was not set correctly."); + } + + /// + ///A test for CRC + /// + [TestMethod()] + public void CRCTest1() + { + Assert.AreEqual(3206462296, ar.CRC(1, 11), "CRC[1][11] was not set correctly."); + } + + /// + ///A test for CRC + /// + [TestMethod()] + public void CRCTest() + { + Assert.AreEqual(3762425816, ar.CRC(0), "CRC[0] was not set correctly."); + Assert.AreEqual(3103217968, ar.CRC(1), "CRC[1] was not set correctly."); + Assert.AreEqual(3068174852, ar.CRC(2), "CRC[2] was not set correctly."); + } + + /// + ///A test for CRCWONULL + /// + [TestMethod()] + public void CRCWONULLTest1() + { + Assert.AreEqual(0062860870, ar.CRCWONULL(2, 19), "CRC32WONULL[2][19] was not set correctly."); + Assert.AreEqual(0950746738, ar.CRCWONULL(2, -2), "CRC32WONULL[2][-2] was not set correctly."); + } + + /// + ///A test for CRCWONULL + /// + [TestMethod()] + public void CRCWONULLTest() + { + Assert.AreEqual(2395016718, ar.CRCWONULL(0), "CRC32WONULL[0] was not set correctly."); + Assert.AreEqual(0834934371, ar.CRCWONULL(1), "CRC32WONULL[1] was not set correctly."); + Assert.AreEqual(4123211700, ar.CRCWONULL(2), "CRC32WONULL[2] was not set correctly."); + Assert.AreEqual(0564210909, ar.CRCWONULL(3), "CRC32WONULL[3] was not set correctly."); + } + } + + +} diff --git a/CUETools/CUETools.TestCodecs/CUETools.TestCodecs.csproj b/CUETools/CUETools.TestCodecs/CUETools.TestCodecs.csproj index 74a1ffd..7269a26 100644 --- a/CUETools/CUETools.TestCodecs/CUETools.TestCodecs.csproj +++ b/CUETools/CUETools.TestCodecs/CUETools.TestCodecs.csproj @@ -37,7 +37,7 @@ - +