Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(186)

Unified Diff: service/rawdatastore/invertible_test.go

Issue 1259593005: Add 'user friendly' datastore API. (Closed) Base URL: https://github.com/luci/gae.git@master
Patch Set: 100% coverage of new code Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: service/rawdatastore/invertible_test.go
diff --git a/service/rawdatastore/invertible_test.go b/service/rawdatastore/invertible_test.go
deleted file mode 100644
index 1040f6d13fa30be8018131e3b28f04fe9cdb896c..0000000000000000000000000000000000000000
--- a/service/rawdatastore/invertible_test.go
+++ /dev/null
@@ -1,89 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-package rawdatastore
-
-import (
- "bytes"
- "testing"
-
- . "github.com/smartystreets/goconvey/convey"
-)
-
-func TestInvertible(t *testing.T) {
- t.Parallel()
-
- Convey("Test InvertibleByteBuffer", t, func() {
- inv := Invertible(&bytes.Buffer{})
-
- Convey("normal writing", func() {
- Convey("Write", func() {
- n, err := inv.Write([]byte("hello"))
- So(err, ShouldBeNil)
- So(n, ShouldEqual, 5)
- So(inv.String(), ShouldEqual, "hello")
- })
- Convey("WriteString", func() {
- n, err := inv.WriteString("hello")
- So(err, ShouldBeNil)
- So(n, ShouldEqual, 5)
- So(inv.String(), ShouldEqual, "hello")
- })
- Convey("WriteByte", func() {
- for i := byte('a'); i < 'f'; i++ {
- err := inv.WriteByte(i)
- So(err, ShouldBeNil)
- }
- So(inv.String(), ShouldEqual, "abcde")
-
- Convey("ReadByte", func() {
- for i := 0; i < 5; i++ {
- b, err := inv.ReadByte()
- So(err, ShouldBeNil)
- So(b, ShouldEqual, byte('a')+byte(i))
- }
- })
- })
- })
- Convey("inverted writing", func() {
- inv.Invert()
- Convey("Write", func() {
- n, err := inv.Write([]byte("hello"))
- So(err, ShouldBeNil)
- So(n, ShouldEqual, 5)
- So(inv.String(), ShouldEqual, "\x97\x9a\x93\x93\x90")
- })
- Convey("WriteString", func() {
- n, err := inv.WriteString("hello")
- So(err, ShouldBeNil)
- So(n, ShouldEqual, 5)
- So(inv.String(), ShouldEqual, "\x97\x9a\x93\x93\x90")
- })
- Convey("WriteByte", func() {
- for i := byte('a'); i < 'f'; i++ {
- err := inv.WriteByte(i)
- So(err, ShouldBeNil)
- }
- So(inv.String(), ShouldEqual, "\x9e\x9d\x9c\x9b\x9a")
-
- Convey("ReadByte", func() {
- for i := 0; i < 5; i++ {
- b, err := inv.ReadByte()
- So(err, ShouldBeNil)
- So(b, ShouldEqual, byte('a')+byte(i)) // inverted back to normal
- }
- })
- })
- })
- Convey("Toggleable", func() {
- inv.Invert()
- n, err := inv.Write([]byte("hello"))
- So(err, ShouldBeNil)
- inv.Invert()
- n, err = inv.Write([]byte("hello"))
- So(n, ShouldEqual, 5)
- So(inv.String(), ShouldEqual, "\x97\x9a\x93\x93\x90hello")
- })
- })
-}

Powered by Google App Engine
This is Rietveld 408576698