*/
@Test
public void changeNumberDiffSeqNum()
throws Exception
{
ChangeNumber CN1;
ChangeNumber CN2;
CN1 = new ChangeNumber((long)0, 3, 0);
// 3-0 = 3
CN2 = new ChangeNumber((long)0, 0, 0);
assertEquals(ChangeNumber.diffSeqNum(CN1, CN2), 3);
// 3-1 = 2
CN2 = new ChangeNumber((long)0, 1, 0);
assertEquals(ChangeNumber.diffSeqNum(CN1, CN2), 2);
// 3-3 = 0
CN2 = new ChangeNumber((long)0, 3, 0);
assertEquals(ChangeNumber.diffSeqNum(CN1, CN2), 0);
// 3-4 = 0 (CN1 must be newer otherwise 0 should be returned)
CN2 = new ChangeNumber((long)0, 4, 0);
assertEquals(ChangeNumber.diffSeqNum(CN1, CN2), 0);
CN1 = new ChangeNumber((long)0, 0, 0);
// 0-0 = 0
CN2 = new ChangeNumber((long)0, 0, 0);
assertEquals(ChangeNumber.diffSeqNum(CN1, CN2), 0);
// 0-1 = 0 (CN1 must be newer otherwise 0 should be returned)
CN2 = new ChangeNumber((long)0, 1, 0);
assertEquals(ChangeNumber.diffSeqNum(CN1, CN2), 0);
CN1 = new ChangeNumber((long)0, 5, 0);
CN2 = new ChangeNumber((long)0, 2, 0);
// 5-null = 5
assertEquals(ChangeNumber.diffSeqNum(CN1, null), 5);
// null-2 = 0
assertEquals(ChangeNumber.diffSeqNum(null, CN2), 0);
// null-null = 0
assertEquals(ChangeNumber.diffSeqNum(null, null), 0);
CN1 = new ChangeNumber((long)1111111, 2, 0);
CN2 = new ChangeNumber((long)3333333, 4, 0);
// CN1 older than CN2 -> 0
assertEquals(ChangeNumber.diffSeqNum(CN1, CN2), 0);
CN1 = new ChangeNumber((long)3333333, 1, 0);
CN2 = new ChangeNumber((long)1111111, Integer.MAX_VALUE-1, 0);
// CN1 seqnum looped
assertEquals(ChangeNumber.diffSeqNum(CN1, CN2), 3);
}