Beispiel #1
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);
        }
Beispiel #2
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);
        }
Beispiel #4
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);
        }
Beispiel #5
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);
        }