Diff

Differences From Artifact [a857b5c640]:

To Artifact [f071d3739a]:


49
50
51
52
53
54
55
56
57
58
59
60
61
62
63

func TestBlockReader(t *testing.T) {
	var (
		input  []byte = []byte{0, 1, 2, 3, 4, 5, 6, 7}
		output []byte = make([]byte, 16)

		reader *bytes.Reader = bytes.NewReader(input)
		min    io.Reader     = BlockReader(reader, 4)
	)

	// Expecting a read count of 2
	count, err := min.Read(output[:2])
	if count != 2 {
		t.Error("Invalid read count from MinReader", count)
	}







|







49
50
51
52
53
54
55
56
57
58
59
60
61
62
63

func TestBlockReader(t *testing.T) {
	var (
		input  []byte = []byte{0, 1, 2, 3, 4, 5, 6, 7}
		output []byte = make([]byte, 16)

		reader *bytes.Reader = bytes.NewReader(input)
		min    io.Reader     = SizedReader(reader, 4)
	)

	// Expecting a read count of 2
	count, err := min.Read(output[:2])
	if count != 2 {
		t.Error("Invalid read count from MinReader", count)
	}
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
		t.Error("Invalid read count from MinReader", count)
	}
	if err != nil {
		t.Error("Unexpected error from MinReader", err)
	}

	// Expecting a read count of 0 with an EOF as the buffer should be empty
	count, err = min.Read(output[:4])
	if count != 0 {
		t.Error("Invalid read count from MinReader", count)
	}
	if err != io.EOF {
		t.Error("Unexpected error from MinReader", err)
	}
}







|







80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
		t.Error("Invalid read count from MinReader", count)
	}
	if err != nil {
		t.Error("Unexpected error from MinReader", err)
	}

	// Expecting a read count of 0 with an EOF as the buffer should be empty
	count, err = min.Read(output[:1])
	if count != 0 {
		t.Error("Invalid read count from MinReader", count)
	}
	if err != io.EOF {
		t.Error("Unexpected error from MinReader", err)
	}
}