Check-in [b0ff11dfcd]
Overview
Comment:Fixing ioutil tests to compile :)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:b0ff11dfcd51181620620bb1febb4fa4d6f60fc5
User & Date: spaskalev on 2014-12-23 19:18:09
Other Links: manifest | tags
Context
2014-12-23
20:53
Renamed BlockReader to SizedReader, modified ioutil tests for 100% code coverage check-in: 11d1c50cd5 user: spaskalev tags: trunk
19:18
Fixing ioutil tests to compile :) check-in: b0ff11dfcd user: spaskalev tags: trunk
18:52
Renamed MinReader to BlockReader. The later is now used by predictor's decompressor to simplify the code and deal away with the need for internal buffering. check-in: 38f8e62c81 user: spaskalev tags: trunk
Changes

Modified src/0dev.org/ioutil/ioutil_test.go from [8530a31260] to [a857b5c640].

43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
	delta := diff.Diff(diff.D{len(input), len(output),
		func(i, j int) bool { return input[i] == output[j] }})
	if len(delta.Added) > 0 || len(delta.Removed) > 0 {
		t.Error("Differences detected ", delta)
	}
}

func TestMinReader(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     = MinReader(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)
	}







|





|







43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
	delta := diff.Diff(diff.D{len(input), len(output),
		func(i, j int) bool { return input[i] == output[j] }})
	if len(delta.Added) > 0 || len(delta.Removed) > 0 {
		t.Error("Differences detected ", delta)
	}
}

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)
	}