(t *testing.T)
| 56 | } |
| 57 | |
| 58 | func TestIndexKey(t *testing.T) { |
| 59 | for i := 0; i < 10; i++ { |
| 60 | b1, err := createRandomBlock(genesisHash, false) |
| 61 | |
| 62 | if err != nil { |
| 63 | t.Fatalf("error occurred: %v", err) |
| 64 | } |
| 65 | |
| 66 | b2, err := createRandomBlock(genesisHash, false) |
| 67 | |
| 68 | if err != nil { |
| 69 | t.Fatalf("error occurred: %v", err) |
| 70 | } |
| 71 | |
| 72 | // Test partial order |
| 73 | bi1 := newBlockNode(rand.Int31(), b1, nil) |
| 74 | bi2 := newBlockNode(rand.Int31(), b2, nil) |
| 75 | k1 := bi1.indexKey() |
| 76 | k2 := bi2.indexKey() |
| 77 | |
| 78 | if c1, c2 := bytes.Compare(k1, k2) < 0, bi1.height < bi2.height; c1 != c2 { |
| 79 | t.Fatalf("unexpected compare result: heights=%d,%d keys=%s,%s", |
| 80 | bi1.height, bi2.height, hex.EncodeToString(k1), hex.EncodeToString(k2)) |
| 81 | } |
| 82 | |
| 83 | if c1, c2 := bytes.Compare(k1, k2) > 0, bi1.height > bi2.height; c1 != c2 { |
| 84 | t.Fatalf("unexpected compare result: heights=%d,%d keys=%s,%s", |
| 85 | bi1.height, bi2.height, hex.EncodeToString(k1), hex.EncodeToString(k2)) |
| 86 | } |
| 87 | } |
| 88 | } |
| 89 | |
| 90 | func TestMultiChain(t *testing.T) { |
| 91 | //log.SetLevel(log.InfoLevel) |
nothing calls this directly
no test coverage detected