1 2 17 18 19 20 package org.apache.poi.hssf.record; 21 22 23 import junit.framework.TestCase; 24 25 33 public class TestSCLRecord 34 extends TestCase 35 { 36 byte[] data = new byte[] { 37 (byte)0x3,(byte)0x0,(byte)0x4,(byte)0x0 38 }; 39 40 public TestSCLRecord(String name) 41 { 42 super(name); 43 } 44 45 public void testLoad() 46 throws Exception 47 { 48 SCLRecord record = new SCLRecord((short)0xa0, (short)data.length, data); 49 assertEquals( 3, record.getNumerator()); 50 assertEquals( 4, record.getDenominator()); 51 52 53 assertEquals( 8, record.getRecordSize() ); 54 55 record.validateSid((short)0xa0); 56 } 57 58 public void testStore() 59 { 60 SCLRecord record = new SCLRecord(); 61 record.setNumerator( (short)3 ); 62 record.setDenominator( (short)4 ); 63 64 65 byte [] recordBytes = record.serialize(); 66 assertEquals(recordBytes.length - 4, data.length); 67 for (int i = 0; i < data.length; i++) 68 assertEquals("At offset " + i, data[i], recordBytes[i+4]); 69 } 70 } 71 | Popular Tags |