You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: block_witness_test.go
    path of file: ./repos/bytom/protocol/bc/types
    
    the code of the file until where you have to start completion: package types

import (
	"bytes"
	"encoding/hex"
	"testing"

	"github.com/bytom/bytom/encoding/blockchain"
	"github.com/bytom/bytom/testutil"
)

func TestReadWriteBlockWitness(t *testing.T) {
	cases := []struct {
		name      string
		witness   BlockWitness
		hexString string
	}{
		{
			name:      "normal block witness",
			witness:   testutil.MustDecodeHexString("e0776a3cf17b3e0f8340caeee32a75d02ecc25cf20bee9e5c7503bca3b2703c3c61fdcb4211ed59b58eb025ac81e06b138d54b5d01ea4614dd0f65e641836900"),
			hexString: "40e0776a3cf17b3e0f8340caeee32a75d02ecc25cf20bee9e5c7503bca3b2703c3c61fdcb4211ed59b58eb025ac81e06b138d54b5d01ea4614dd0f65e641836900",
		},
		{
			name:      "empty block witness",
			witness:   BlockWitness{},
			hexString: "00",
		},
	}

	for _, c := range cases {

    
func TestReadWriteBlockWitness(t *testing.T) {
	cases := []struct {
		name      string
		witness   BlockWitness
		hexString string
	}{
		{
			name:      "normal block witness",
			witness:   testutil.MustDecodeHexString("e0776a3cf17b3e0f8340caeee32a75d02ecc25cf20bee9e5c7503bca3b2703c3c61fdcb4211ed59b58eb025ac81e06b138d54b5d01ea4614dd0f65e641836900"),
			hexString: "40e0776a3cf17b3e0f8340caeee32a75d02ecc25cf20bee9e5c7503bca3b2703c3c61fdcb4211ed59b58eb025ac81e06b138d54b5d01ea4614dd0f65e641836900",
		},
		{
			name:      "empty block witness",
			witness:   BlockWitness{},
			hexString: "00",
		},
	}

	for _, c := range cases {
		t.Run(c.name, func(t *testing.T) {
			buff := []byte{}
			buffer := bytes.NewBuffer(buff)
			if err := c.witness.writeTo(buffer); err != nil {
				t.Fatal(err)
			}

			hexString := hex.EncodeToString(buffer.Bytes())
			if hexString != c.hexString {
				t.Errorf("test write block commitment fail, got:%s, want:%s", hexString, c.hexString)
			}

			blockWitness := &BlockWitness{}
			if err := blockWitness.readFrom(blockchain.NewReader(buffer.Bytes())); err != nil {
				t.Fatal(err)
			}

			if !testutil.DeepEqual(*blockWitness, c.witness) {
				t.Errorf("test read block commitment fail, got:%v, want:%v", *blockWitness, c.witness)
			}
		})
	}
}