@@ -13,6 +13,8 @@ public class BlockEventCacheTest {
1313
1414 @ Test
1515 public void test () throws Exception {
16+ BlockCapsule .BlockId solidID = new BlockCapsule .BlockId (getBlockId (), 100 );
17+
1618 BlockEvent be1 = new BlockEvent ();
1719 BlockCapsule .BlockId b1 = new BlockCapsule .BlockId (getBlockId (), 1 );
1820 be1 .setBlockId (b1 );
@@ -36,32 +38,46 @@ public void test() throws Exception {
3638
3739 BlockEventCache .init (b1 );
3840
41+ BlockEvent event = new BlockEvent ();
42+ BlockCapsule .BlockId blockId = new BlockCapsule .BlockId (getBlockId (), 2 );
43+ event .setBlockId (blockId );
44+ event .setParentId (b1 );
45+ event .setSolidId (blockId );
46+ BlockEventCache .add (event );
47+ Assert .assertEquals (event , BlockEventCache .getHead ());
48+ Assert .assertEquals (blockId , BlockEventCache .getSolidId ());
49+ Assert .assertEquals (event , BlockEventCache .getBlockEvent (blockId ));
50+
51+ BlockEventCache .init (b1 );
52+
3953 BlockEvent be2 = new BlockEvent ();
4054 BlockCapsule .BlockId b2 = new BlockCapsule .BlockId (getBlockId (), 2 );
4155 be2 .setBlockId (b2 );
4256 be2 .setParentId (b1 );
43- be2 .setSolidId (b1 );
57+ be2 .setSolidId (solidID );
4458 BlockEventCache .add (be2 );
4559 Assert .assertEquals (be2 , BlockEventCache .getHead ());
60+ Assert .assertEquals (b2 , BlockEventCache .getSolidId ());
4661 Assert .assertEquals (be2 , BlockEventCache .getBlockEvent (b2 ));
4762
4863 BlockEvent be22 = new BlockEvent ();
4964 BlockCapsule .BlockId b22 = new BlockCapsule .BlockId (getBlockId (), 2 );
5065 be22 .setBlockId (b22 );
5166 be22 .setParentId (b1 );
52- be22 .setSolidId (b22 );
67+ be22 .setSolidId (solidID );
5368 BlockEventCache .add (be22 );
5469 Assert .assertEquals (be2 , BlockEventCache .getHead ());
5570 Assert .assertEquals (be22 , BlockEventCache .getBlockEvent (b22 ));
56- Assert .assertEquals (b22 , BlockEventCache .getSolidId ());
71+ Assert .assertEquals (b2 , BlockEventCache .getSolidId ());
5772
5873 BlockEvent be3 = new BlockEvent ();
5974 BlockCapsule .BlockId b3 = new BlockCapsule .BlockId (getBlockId (), 3 );
6075 be3 .setBlockId (b3 );
6176 be3 .setParentId (b22 );
62- be3 .setSolidId (b22 );
77+ be3 .setSolidId (solidID );
6378 BlockEventCache .add (be3 );
6479 Assert .assertEquals (be3 , BlockEventCache .getHead ());
80+ Assert .assertEquals (b3 , BlockEventCache .getSolidId ());
6581
6682 List <BlockEvent > list = BlockEventCache .getSolidBlockEvents (b2 );
6783 Assert .assertEquals (1 , list .size ());
0 commit comments