OPageChanges pageChanges = new OPageChanges();
pageChanges.addChanges(10, new byte[] { 0, 1, 2, 3 }, new byte[] { 3, 2, 1, 0 });
pageChanges.addChanges(20, new byte[] { 4, 5, 6, 7 }, new byte[] { 7, 6, 5, 4 });
pageChanges.addChanges(30, new byte[] { 8, 9, 10, 11 }, new byte[] { 11, 10, 9, 8 });
ODirectMemoryPointer pointer = new ODirectMemoryPointer(1024 + ODurablePage.PAGE_PADDING);
pageChanges.applyChanges(pointer);
Assert.assertEquals(pointer.get(10 + ODurablePage.PAGE_PADDING, 4), new byte[] { 0, 1, 2, 3 });
Assert.assertEquals(pointer.get(20 + ODurablePage.PAGE_PADDING, 4), new byte[] { 4, 5, 6, 7 });
Assert.assertEquals(pointer.get(30 + ODurablePage.PAGE_PADDING, 4), new byte[] { 8, 9, 10, 11 });
pageChanges.revertChanges(pointer);
Assert.assertEquals(pointer.get(10 + ODurablePage.PAGE_PADDING, 4), new byte[] { 3, 2, 1, 0 });
Assert.assertEquals(pointer.get(20 + ODurablePage.PAGE_PADDING, 4), new byte[] { 7, 6, 5, 4 });
Assert.assertEquals(pointer.get(30 + ODurablePage.PAGE_PADDING, 4), new byte[] { 11, 10, 9, 8 });
pointer.free();
}