public void TestSingleton() { var z = new CoinCompressor(); z.Add(100); var foo = new CoinDecompressor(z.Finished()); Assert.IsTrue(foo.Count() == 1); Assert.IsTrue(foo.SequenceEqual(new int[] { 100 })); }
public void TestAscending() { var z = new CoinCompressor(); new int[] { 1, 2, 3, 4, 7, 6, 2 }.ForEach(z.Add); var foo = new CoinDecompressor(z.Finished()); Assert.IsTrue(foo.Count() == 7); Assert.IsTrue(foo.SequenceEqual(new int[] { 1, 2, 3, 4, 7, 6, 2 })); }
public void TestWhereTwoValuesSame() { var z = new CoinCompressor(); new int[] { 5, 5, 5, 4 }.ForEach(z.Add); var foo = new CoinDecompressor(z.Finished()); Assert.IsTrue(foo.Count() == 4); Assert.IsTrue(foo.SequenceEqual(new int[] { 5, 5, 5, 4 })); }
public void TestCompressedCoinComplexGaps() { var z = new CoinCompressor(); z.Add(100); z.Add(98); z.Add(94); z.Add(92); z.Add(91); z.Add(85); var foo = new CoinDecompressor(z.Finished()); Assert.IsTrue(foo.Count() == 6); Assert.IsTrue(foo.SequenceEqual(new int[] { 100, 98, 94, 92, 91, 85 })); }