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); }
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); }
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); }
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); }