public void TestReadWriteTokenValueBytes() { ArrayPtg ptg = Create(ENCODED_PTG_DATA, ENCODED_CONSTANT_DATA); Assert.AreEqual(3, ptg.ColumnCount); Assert.AreEqual(2, ptg.RowCount); Object[,] values = ptg.GetTokenArrayValues(); Assert.AreEqual(2, values.Length); Assert.AreEqual(true, values[0, 0]); Assert.AreEqual("ABCD", values[0, 1]); Assert.AreEqual(0d, values[1, 0]); Assert.AreEqual(false, values[1, 1]); Assert.AreEqual("FG", values[1, 2]); byte[] outBuf = new byte[ENCODED_CONSTANT_DATA.Length]; ptg.WriteTokenValueBytes(new LittleEndianByteArrayOutputStream(outBuf, 0)); if (outBuf[0] == 4) { throw new AssertionException("Identified bug 42564b"); } Assert.IsTrue(Arrays.Equals(ENCODED_CONSTANT_DATA, outBuf)); }
public void TestReadWriteTokenValueBytes() { ArrayPtg ptg = new ArrayPtg(TestcaseRecordInputStream.CreateWithFakeSid(ENCODED_PTG_DATA)); ptg.ReadTokenValues(TestcaseRecordInputStream.CreateWithFakeSid(ENCODED_CONSTANT_DATA)); Assert.AreEqual(3, ptg.ColumnCount); Assert.AreEqual(2, ptg.RowCount); object[] values = ptg.GetTokenArrayValues(); Assert.AreEqual(6, values.Length); Assert.AreEqual(true, values[0]); Assert.AreEqual("ABCD", values[1]); Assert.AreEqual(0, Convert.ToInt32(values[3])); Assert.AreEqual(false, values[4]); Assert.AreEqual("FG", values[5]); byte[] outBuf = new byte[ENCODED_CONSTANT_DATA.Length]; ptg.WriteTokenValueBytes(new LittleEndianByteArrayOutputStream(outBuf, 0)); if (outBuf[0] == 4) { throw new AssertFailedException("Identified bug 42564b"); } Assert.IsTrue(NPOI.Util.Arrays.Equals(ENCODED_CONSTANT_DATA, outBuf)); }