diff options
author | Ian Cottrell <iancottrell@google.com> | 2015-03-18 17:31:07 +0000 |
---|---|---|
committer | Ian Cottrell <iancottrell@google.com> | 2015-03-20 12:47:12 +0000 |
commit | ac761a60af2f126ed80d9a29b5c328bf74163efa (patch) | |
tree | 603ec167d9d7a84ba2e40863d00904a95df97a37 /binary/roundtrip_test.go | |
parent | 04872aaa44c69d3adce68feb0b4c613c2fd61be4 (diff) | |
download | gpu-ac761a60af2f126ed80d9a29b5c328bf74163efa.tar.gz |
Split the variable size integer writer from the object hierarchy encoder
Change-Id: I587cc45e08d2b49a88b93e1816d0a22def405356
Diffstat (limited to 'binary/roundtrip_test.go')
-rw-r--r-- | binary/roundtrip_test.go | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/binary/roundtrip_test.go b/binary/roundtrip_test.go index 1496f8b62..6dd7746b9 100644 --- a/binary/roundtrip_test.go +++ b/binary/roundtrip_test.go @@ -12,11 +12,15 @@ // See the License for the specific language governing permissions and // limitations under the License. -package binary +package binary_test import ( "reflect" + "android.googlesource.com/platform/tools/gpu/binary" + "android.googlesource.com/platform/tools/gpu/binary/cyclic" + "android.googlesource.com/platform/tools/gpu/binary/vle" + "math/rand" "testing" ) @@ -49,7 +53,7 @@ func (b *buffer) Rewind() { b.at = 0 } -func prepare(a interface{}) (*Encoder, *Decoder, *buffer) { +func prepare(a interface{}) (binary.Encoder, binary.Decoder, *buffer) { rand.Seed(1) s := reflect.ValueOf(a) maxSize := 0 @@ -84,7 +88,9 @@ func prepare(a interface{}) (*Encoder, *Decoder, *buffer) { } // build a big enough buffer, and wrap it in coders buf := &buffer{data: make([]byte, 0, s.Len()*maxSize)} - return NewEncoder(buf), NewDecoder(buf), buf + e := cyclic.Encoder(vle.Writer(buf)) + d := cyclic.Decoder(vle.Reader(buf)) + return e, d, buf } func TestRoundTripInt8(t *testing.T) { |