* Test serialisation of a particually complex example
* This test is currently broken!
*/
- public void BROKENtestComplexSerialise() throws Exception {
+ public void testComplexSerialise() throws Exception {
byte[] data = new byte[] {
- 0x53, 0x01, 0x0B, 0xF0-256, 0x9C-256, 0x01, 0x00, 0x00, 0x42, 0x01,
- 0x49, 0x00, 0x00, 0x00, 0x43, 0x01, 0x85-256, 0x00, 0x00,
- 0x00, 0x44, 0x01, 0x04, 0x00, 0x00, 0x00,
- 0x45, 0xC1-256, 0x88-256, 0x00, 0x00, 0x00, 0x46, 0xC1-256,
- 0x90-256, 0x00, 0x00, 0x00, 0x7F, 0x01, 0x01, 0x00,
- 0x01, 0x00, 0x80-256, 0x01, 0x00, 0x00, 0x00, 0x00, 0x81-256,
- 0x01, 0x02, 0x00, 0x00, 0x08, 0xBF-256, 0x01,
- 0x10, 0x00, 0x10, 0x00, 0xC0-256, 0x01, 0x01, 0x00, 0x00, 0x08,
+ 0x53, 0x01, 0x0B, 0xF0-256, 0x9C-256, 0x01, 0x00, 0x00,
+ // Simple data follows
+ 0x42, 0x01, 0x49, 0x00, 0x00, 0x00, // SP @ 8
+ 0x43, 0x01, 0x85-256, 0x00, 0x00, 0x00, // SP @ 14
+ 0x44, 0x01, 0x04, 0x00, 0x00, 0x00, // SP @ 20
+ 0x45, 0xC1-256, 0x88-256, 0x00, 0x00, 0x00, // SP @ 26
+ 0x46, 0xC1-256, 0x90-256, 0x00, 0x00, 0x00, // SP @ 32
+ 0x7F, 0x01, 0x01, 0x00, 0x01, 0x00,
+ 0x80-256, 0x01, 0x00, 0x00, 0x00, 0x00,
+ 0x81-256, 0x01, 0x02, 0x00, 0x00, 0x08,
+ 0xBF-256, 0x01, 0x10, 0x00, 0x10, 0x00,
+ 0xC0-256, 0x01, 0x01, 0x00, 0x00, 0x08, // SP 10
0xC1-256, 0x01, 0x00, 0x00, 0x01, 0x00,
- 0xC4-256, 0x01, 0x00, 0x00, 0x00, 0x00, 0xCB-256, 0x01, 0x38,
- 0x63, 0x00, 0x00, 0xCD-256, 0x01, 0x00, 0x00,
- 0x00, 0x00, 0xCE-256, 0x01, 0x00, 0x00, 0x00, 0x00, 0xD0-256,
- 0x01, 0x00, 0x00, 0x00, 0x00, 0xD1-256, 0x01,
- 0x00, 0x00, 0x00, 0x00, 0xD7-256, 0x01, 0x00, 0x00, 0x00, 0x00,
+ 0xC4-256, 0x01, 0x00, 0x00, 0x00, 0x00,
+ 0xCB-256, 0x01, 0x38, 0x63, 0x00, 0x00,
+ 0xCD-256, 0x01, 0x00, 0x00, 0x00, 0x00,
+ 0xCE-256, 0x01, 0x00, 0x00, 0x00, 0x00, // SP 15
+ 0xD0-256, 0x01, 0x00, 0x00, 0x00, 0x00,
+ 0xD1-256, 0x01, 0x00, 0x00, 0x00, 0x00,
+ 0xD7-256, 0x01, 0x00, 0x00, 0x00, 0x00,
0xFF-256, 0x01, 0x18, 0x00, 0x18, 0x00,
- 0x01, 0x02, 0x02, 0x00, 0x00, 0x08, 0x3F, 0x02, 0x00, 0x00,
- 0x02, 0x00, 0x22, 0x00, 0x22, 0x00,
- 0xF0-256, 0xFF-256, 0x18, 0x00, 0x28, 0x00, 0x04, 0x00, 0x34,
+ 0x01, 0x02, 0x02, 0x00, 0x00, 0x08,
+ 0x3F, 0x02, 0x00, 0x00, 0x02, 0x00, // SP 21
+
+ // Complex data follows
+
+ // Complex data for Array #325
+ // Array header
+ 0x22, 0x00, 0x22, 0x00, 0xF0-256, 0xFF-256,
+ // Array data
+ 0x18, 0x00, 0x28, 0x00, 0x04, 0x00, 0x34,
0x00, 0x04, 0x00, 0x28, 0x00, 0x04, 0x00,
0x1C, 0x00, 0x04, 0x00, 0x10, 0x00, 0x04, 0x00, 0x04, 0x00, 0x10,
0x00, 0x00, 0x00, 0x1C, 0x00,
0x00, 0x30, 0x00, 0x08, 0x00,
0x3C, 0x00, 0x08, 0x00, 0x48, 0x00, 0x08, 0x00, 0x54, 0x00, 0x00,
0x00, 0x48, 0x00, 0x00, 0x00,
- 0x3C, 0x00, 0x00, 0x00, 0x30, 0x00, 0x04, 0x00, 0x24, 0x00, 0x45,
- 0x00, 0x48, 0x00, 0x02, 0x00,
+ 0x3C, 0x00, 0x00, 0x00, 0x30, 0x00, 0x04, 0x00, 0x24, 0x00,
+ // Complex data for Array #326
+ // Array header
+ 0x45, 0x00, 0x48, 0x00, 0x02, 0x00,
+ // Array data
0x00, 0x40, 0x00, 0xB0-256, 0x01, 0x00, 0x00, 0xB0-256, 0x01, 0x00,
0x00, 0xB0-256, 0x01, 0x00, 0x00, 0xB0-256,
0x01, 0x00, 0x00, 0xB0-256, 0x01, 0x00, 0x00, 0xB0-256, 0x01, 0x00,
// Create the record
EscherOptRecord r = new EscherOptRecord();
- r.fillFields( data, new DefaultEscherRecordFactory() );
+ int filled = r.fillFields( data, new DefaultEscherRecordFactory() );
// Check it's the right length
+ assertEquals(data.length, filled);
assertEquals(data.length, r.getRecordSize());
// Serialise it
// Check it serialised it back to the same data
assertEquals(data.length, written);
for(int i=0; i<data.length; i++) {
- System.err.println(i);
assertEquals(data[i], dest[i]);
}
}