public void TestThatConstructorAddsExpectedEndOfFileSymbolToTheEndOfAlphabet()
        {
            var expectedAlphabet = new List <int>(alphabet);

            expectedAlphabet.Add(alphabet.Last() + 1);

            baseArithmeticCoding = new BaseArithmeticCoding(alphabet);

            CollectionAssert.AreEqual(expectedAlphabet, baseArithmeticCoding.alphabet);
        }
        public void TestThatInitializeModelInitializesTotalSum()
        {
            var alphabet = new List <int> {
                2, 4, 7, 10
            };
            var expectedTotalSum = 5;

            baseArithmeticCoding = new BaseArithmeticCoding(alphabet);
            baseArithmeticCoding.InitializeModel();

            Assert.AreEqual(expectedTotalSum, baseArithmeticCoding.totalSum);
        }
        public void TestThatInitializeModelInitializesSums()
        {
            var alphabet = new List <int> {
                2, 4, 7, 10
            };
            var expectedSums = new List <int> {
                0, 1, 2, 3, 4, 5
            };

            baseArithmeticCoding = new BaseArithmeticCoding(alphabet);
            baseArithmeticCoding.InitializeModel();

            CollectionAssert.AreEqual(expectedSums, baseArithmeticCoding.sums);
        }
        public void TestThatConstructorOrdersAlphabetAscending()
        {
            var unorderedAlphabet = new List <int> {
                6, 1, 9, 3, 2
            };
            var expectedOrderedAlphabet = new List <int> {
                1, 2, 3, 6, 9
            };

            baseArithmeticCoding = new BaseArithmeticCoding(unorderedAlphabet);

            baseArithmeticCoding.alphabet.Remove(alphabet.Last());
            CollectionAssert.AreEqual(expectedOrderedAlphabet, baseArithmeticCoding.alphabet);
        }
        public void TestThatConstructorAddsAnExtraEndOfFileSymbol()
        {
            baseArithmeticCoding = new BaseArithmeticCoding(alphabet);

            Assert.IsTrue(baseArithmeticCoding.alphabet.Count == alphabet.Count + 1);
        }
 public void Setup()
 {
     baseArithmeticCoding = new BaseArithmeticCoding(alphabet);
 }