public void TestDecodeNoOpen() { Mpg123 mpg123 = new Mpg123(); uint done = 0; Assert.That(() => mpg123.Decode(null, 0, null, 0, ref done), Throws.TypeOf <Mpg123.ErrorException>()); }
public void TestDecodeNullInputAndOutput() { Mpg123 mpg123 = new Mpg123(); mpg123.OpenFeed(); uint done = 0; Assert.That(() => mpg123.Decode(null, 0, null, 0, ref done), Throws.Nothing); }
public void TestDecodeInconsistentOutputSizeMinor() { Mpg123 mpg123 = new Mpg123(); mpg123.OpenFeed(); byte[] outBuffer = new byte[100]; uint done = 0; Assert.That(() => mpg123.Decode(null, 0, outBuffer, 50, ref done), Throws.Nothing); }
public void TestDecodeInconsistentOutputSizeMajor() { Mpg123 mpg123 = new Mpg123(); mpg123.OpenFeed(); byte[] outBuffer = new byte[100]; uint done = 0; Assert.That(() => mpg123.Decode(null, 0, outBuffer, 300, ref done), Throws.TypeOf <ArgumentOutOfRangeException>()); }
public void TestDecodeNeedMore() { Mpg123 mpg123 = new Mpg123(); mpg123.OpenFeed(); byte[] inBuffer = new byte[8]; uint done = 0; Assert.That(mpg123.Decode(inBuffer, 8, null, 0, ref done), Is.EqualTo(Mpg123.Errors.NEED_MORE)); }
public void TestDecodeNullOutput() { Mpg123 mpg123 = new Mpg123(); mpg123.OpenFeed(); byte[] inBuffer = new byte[8]; uint done = 0; Assert.That(() => mpg123.Decode(inBuffer, 8, null, 0, ref done), Throws.Nothing); }
public void TestDecodeDoneBytes() { Mpg123 mpg123 = new Mpg123(); mpg123.OpenFeed(); string dirName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); string path = Path.Combine(dirName, "bensound-epic.mp3"); byte[] inBuffer = File.ReadAllBytes(path); uint done = 0; mpg123.Decode(inBuffer, (uint)inBuffer.Length, null, 0, ref done); byte[] outBuffer = new byte[100]; while (mpg123.Decode(null, 0, outBuffer, 100, ref done) != Mpg123.Errors.NEED_MORE) { Assert.That(done, Is.EqualTo(100)); } }
public void TestDecodeNewFormat() { Mpg123 mpg123 = new Mpg123(); mpg123.OpenFeed(); string dirName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); string path = Path.Combine(dirName, "bensound-epic.mp3"); byte[] inBuffer = File.ReadAllBytes(path); uint done = 0; Assert.That(mpg123.Decode(inBuffer, (uint)inBuffer.Length, null, 0, ref done), Is.EqualTo(Mpg123.Errors.NEW_FORMAT)); }