public void TestThatWhenNumberOfBitsIs9FixedSaveModeCreatesFileOfExpectedSize()
        {
            var expectedBitsToRead = GetExpectedBitsToRead(array);

            using (bitWriter = SaveModesTestsCommon.GetBitWriter(outputFilePath))
                fixedSaveMode.WriteValues(array, bitWriter);

            var createdFileLength = new FileInfo(outputFilePath).Length * 8;

            Assert.AreEqual(expectedBitsToRead, createdFileLength);
        }
Example #2
0
        public void TestThatTableSaveModeCandReadWhatItWrote()
        {
            using (bitWriter = SaveModesTestsCommon.GetBitWriter(outputFilePath))
                tableSaveMode.WriteValues(array, bitWriter);

            int[] returnedArray;
            using (bitReader = SaveModesTestsCommon.GetBitReader(outputFilePath))
                returnedArray = tableSaveMode.ReadValues(123, bitReader);

            CollectionAssert.AreEqual(array, returnedArray);
        }
Example #3
0
        public void TestThatArithmeticSaveModeCandReadWhatItWrote()
        {
            using (bitWriter = SaveModesTestsCommon.GetBitWriter(outputFilePath))
                arithmeticSaveMode.WriteValues(array, bitWriter);
            var bitsToRead = new FileInfo(outputFilePath).Length * 8;

            int[] returnedArray;
            using (bitReader = SaveModesTestsCommon.GetBitReader(outputFilePath))
                returnedArray = arithmeticSaveMode.ReadValues(bitsToRead, bitReader);

            CollectionAssert.AreEqual(array, returnedArray);
        }
        public void TestThatWhenNumberOfBitsIs9FixedSaveModeCanReadWhatItWrote()
        {
            var expectedBitsToRead = GetExpectedBitsToRead(array);

            using (bitWriter = SaveModesTestsCommon.GetBitWriter(outputFilePath))
                fixedSaveMode.WriteValues(array, bitWriter);

            int[] returnedArray;
            using (bitReader = SaveModesTestsCommon.GetBitReader(outputFilePath))
                returnedArray = fixedSaveMode.ReadValues(expectedBitsToRead, bitReader);

            CollectionAssert.AreEqual(array, returnedArray);
        }
Example #5
0
        public void TestThatWhenArrayHas65536ElementsTableSaveModeCandReadWhatItWrote()
        {
            var longArray = SaveModesTestsCommon.GetRandom65536Array();

            using (bitWriter = SaveModesTestsCommon.GetBitWriter(outputFilePath))
                tableSaveMode.WriteValues(longArray, bitWriter);

            int[] returnedArray;
            using (bitReader = SaveModesTestsCommon.GetBitReader(outputFilePath))
                returnedArray = tableSaveMode.ReadValues(123, bitReader);

            CollectionAssert.AreEqual(longArray, returnedArray);
        }
Example #6
0
        public void TestThatWhenArrayHas65536ElementsArithmeticSaveModeCandReadWhatItWrote()
        {
            var longArray = SaveModesTestsCommon.GetRandom65536Array();

            using (bitWriter = SaveModesTestsCommon.GetBitWriter(outputFilePath))
                arithmeticSaveMode.WriteValues(longArray, bitWriter);
            var bitsToRead = new FileInfo(outputFilePath).Length * 8;

            int[] returnedArray;
            using (bitReader = SaveModesTestsCommon.GetBitReader(outputFilePath))
                returnedArray = arithmeticSaveMode.ReadValues(bitsToRead, bitReader);

            CollectionAssert.AreEqual(longArray, returnedArray);
        }
Example #7
0
        public void Setup()
        {
            arithmeticSaveMode = new ArithmeticSaveMode();

            array = SaveModesTestsCommon.GetArray();
        }
        public void Setup()
        {
            fixedSaveMode = new FixedSaveMode(9);

            array = SaveModesTestsCommon.GetArray();
        }
Example #9
0
        public void Setup()
        {
            tableSaveMode = new TableSaveMode();

            array = SaveModesTestsCommon.GetArray();
        }