(t *testing.T)
| 9 | ) |
| 10 | |
| 11 | func TestNewChainHeight(t *testing.T) { |
| 12 | ctx, cancel := context.WithCancel(context.Background()) |
| 13 | |
| 14 | block := &bc.Block{UnsignedBlock: &bc.UnsignedBlock{BlockHeader: &bc.BlockHeader{NextPredicate: &bc.Predicate{}}}} |
| 15 | heights := make(chan uint64, 4) |
| 16 | c, err := NewChain(ctx, block, memstore.New(), heights) |
| 17 | if err != nil { |
| 18 | t.Fatal(err) |
| 19 | } |
| 20 | |
| 21 | heights <- 1 |
| 22 | heights <- 2 |
| 23 | heights <- 0 |
| 24 | heights <- 3 |
| 25 | |
| 26 | <-c.BlockWaiter(3) |
| 27 | if got := c.Height(); got != 3 { |
| 28 | t.Errorf("c.Height() = %d, want %d", got, 3) |
| 29 | } |
| 30 | cancel() |
| 31 | } |
nothing calls this directly
no test coverage detected