From 5b9ebda0b3a26dd711a62cbb0107526b93f1d4f5 Mon Sep 17 00:00:00 2001 From: evan-forbes Date: Tue, 9 Mar 2021 22:01:22 -0600 Subject: [PATCH] add test cases add docs to PutBlock --- types/block.go | 3 ++- types/block_test.go | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/types/block.go b/types/block.go index 20b6ee0678..5ec945aa0c 100644 --- a/types/block.go +++ b/types/block.go @@ -264,7 +264,8 @@ func mustPush(rowTree *nmt.NamespacedMerkleTree, id namespace.ID, data []byte) { } } -// PutBlock add +// PutBlock posts and pins erasured block data to IPFS using the provided +// ipld.NodeAdder. Note: the erasured data is currently recomputed func (b *Block) PutBlock(ctx context.Context, api format.NodeAdder) error { if api == nil { return errors.New("no ipfs node adder provided") diff --git a/types/block_test.go b/types/block_test.go index 5320daf17a..48d9f3e612 100644 --- a/types/block_test.go +++ b/types/block_test.go @@ -1331,7 +1331,10 @@ func TestPutBlock(t *testing.T) { expectErr bool errString string }{ - {"basic", generateRandomData(16), false, ""}, + {"no leaves", generateRandomData(0), false, ""}, + {"single leaf", generateRandomData(1), false, ""}, + {"16 leaves", generateRandomData(16), false, ""}, + {"max square size", generateRandomData(MaxSquareSize), false, ""}, } ctx := context.Background() for _, tc := range testCases {