Check-in [b0ff11dfcd]
Overview
SHA1:b0ff11dfcd51181620620bb1febb4fa4d6f60fc5
Date: 2014-12-23 19:18:09
User: spaskalev
Comment:Fixing ioutil tests to compile :)
Timelines: family | ancestors | descendants | both | trunk
Downloads: Tarball | ZIP archive
Other Links: files | file ages | folders | manifest
Tags And Properties
Context
2014-12-23
20:53
[11d1c50cd5] Renamed BlockReader to SizedReader, modified ioutil tests for 100% code coverage (user: spaskalev, tags: trunk)
19:18
[b0ff11dfcd] Fixing ioutil tests to compile :) (user: spaskalev, tags: trunk)
18:52
[38f8e62c81] 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. (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)
	}