This commit is contained in:
didier.amyot committed 2014-10-14 06:31:36 -07:00
1 parent 4897e8d307
commit 4aca3324c9
10 files changed
+401 -17

No files matched your search

+10
View File
@@ -1,8 +1,10 @@
package helper
import (
"bytes"
"crypto/rsa"
"encoding/binary"
"io"
"math/big"
"math/rand"
)
@@ -64,6 +66,14 @@ func (this *MockIoWriter) Bytes() []byte {
return this.state
}
func (this *MockIoWriter) Reader() io.Reader {
return bytes.NewReader(this.state)
}
func (this *MockIoWriter) ReaderAt() io.ReaderAt {
return bytes.NewReader(this.state)
}
func Range(length int) []byte {
ret := make([]byte, length)
for i, _ := range ret {
+5
View File
@@ -2,6 +2,7 @@ package helper
import (
"fmt"
"io/ioutil"
"math/big"
"math/rand"
"reflect"
@@ -35,6 +36,10 @@ func TestMockIoWriter(t *testing.T) {
t.Fail()
} else if w.Length() != len("something to write") {
t.Fail()
} else if readerOutput, err := ioutil.ReadAll(w.Reader()); err != nil {
t.Error(err)
} else if "something to write" != string(readerOutput) {
t.Error("bad reader")
}
}