コード例 #1
0
ファイル: TestNameRecord.java プロジェクト: aw1621107/hacks
 public void testReserialize() {
   byte[] data =
       HexRead.readFromString(
           ""
               + "20 00 00 01 0B 00 00 00 01 00 00 00 00 00 00 06 3B 00 00 00 00 02 00 00 00 09 00]");
   RecordInputStream in = TestcaseRecordInputStream.create(NameRecord.sid, data);
   NameRecord nr = new NameRecord(in);
   assertEquals(0x0020, nr.getOptionFlag());
   byte[] data2 = nr.serialize();
   TestcaseRecordInputStream.confirmRecordEncoding(NameRecord.sid, data, data2);
 }
コード例 #2
0
  /** tRefN and tAreaN tokens must be preserved when re-serializing conditional format formulas */
  public void testReserializeRefNTokens() {

    RecordInputStream is = TestcaseRecordInputStream.create(CFRuleRecord.sid, DATA_REFN);
    CFRuleRecord rr = new CFRuleRecord(is);
    Ptg[] ptgs = rr.getParsedExpression1();
    assertEquals(3, ptgs.length);
    if (ptgs[0] instanceof RefPtg) {
      throw new AssertionFailedError("Identified bug 45234");
    }
    assertEquals(RefNPtg.class, ptgs[0].getClass());
    RefNPtg refNPtg = (RefNPtg) ptgs[0];
    assertTrue(refNPtg.isColRelative());
    assertTrue(refNPtg.isRowRelative());

    byte[] data = rr.serialize();
    TestcaseRecordInputStream.confirmRecordEncoding(CFRuleRecord.sid, DATA_REFN, data);
  }