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: pagewriter_test.go
    path of file: ./repos/learning/golang/practice/go-crontab/gopath/src/github.com/coreos/etcd/pkg/ioutil
    
    the code of the file until where you have to start completion: // Copyright 2016 The etcd Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// 
    
func TestPageWriterRandom(t *testing.T) {
	// smaller buffer for stress testing
	defaultBufferBytes = 8 * 1024
	pageBytes := 128
	buf := make([]byte, 4*defaultBufferBytes)
	cw := &checkPageWriter{pageBytes: pageBytes, t: t}
	w := NewPageWriter(cw, pageBytes, 0)
	n := 0
	for i := 0; i < 4096; i++ {
		c, err := w.Write(buf[:rand.Intn(len(buf))])
		if err != nil {
			t.Fatal(err)
		}
		n += c
	}
	if cw.writeBytes > n {
		t.Fatalf("wrote %d bytes to io.Writer, but only wrote %d bytes", cw.writeBytes, n)
	}
	if cw.writeBytes-n > pageBytes {
		t.Fatalf("got %d bytes pending, expected less than %d bytes", cw.writeBytes-n, pageBytes)
	}
	t.Logf("total writes: %d", cw.writes)
	t.Logf("total write bytes: %d (of %d)", cw.writeBytes, n)
}