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

Side by Side Diff: service/datastore/properties_test.go

Issue 1550903002: impl/memory: Fix time serialization encoding. (Closed) Base URL: https://github.com/luci/gae@master
Patch Set: Deduplicate time/int conversion logic. Created 4 years, 11 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 package datastore 5 package datastore
6 6
7 import ( 7 import (
8 "math" 8 "math"
9 "testing" 9 "testing"
10 "time" 10 "time"
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 So(pv.Type().String(), ShouldEqual, "PTTime") 117 So(pv.Type().String(), ShouldEqual, "PTTime")
118 }) 118 })
119 Convey("[]byte allows IndexSetting", func() { 119 Convey("[]byte allows IndexSetting", func() {
120 pv := Property{} 120 pv := Property{}
121 So(pv.SetValue([]byte("hello"), ShouldIndex), Sh ouldBeNil) 121 So(pv.SetValue([]byte("hello"), ShouldIndex), Sh ouldBeNil)
122 So(pv.Value(), ShouldResemble, []byte("hello")) 122 So(pv.Value(), ShouldResemble, []byte("hello"))
123 So(pv.IndexSetting(), ShouldEqual, ShouldIndex) 123 So(pv.IndexSetting(), ShouldEqual, ShouldIndex)
124 So(pv.Type().String(), ShouldEqual, "PTBytes") 124 So(pv.Type().String(), ShouldEqual, "PTBytes")
125 }) 125 })
126 }) 126 })
127
128 Convey("Comparison", func() {
129 Convey(`A []byte property should equal a string property with the same value.`, func() {
130 a := MkProperty([]byte("ohaithere"))
131 b := MkProperty("ohaithere")
132 So(a.Equal(&b), ShouldBeTrue)
133 })
134 })
127 }) 135 })
128 } 136 }
129 137
130 func TestDSPropertyMapImpl(t *testing.T) { 138 func TestDSPropertyMapImpl(t *testing.T) {
131 t.Parallel() 139 t.Parallel()
132 140
133 Convey("PropertyMap load/save err conditions", t, func() { 141 Convey("PropertyMap load/save err conditions", t, func() {
134 Convey("empty", func() { 142 Convey("empty", func() {
135 pm := PropertyMap{} 143 pm := PropertyMap{}
136 err := pm.Load(PropertyMap{"hello": {Property{}}}) 144 err := pm.Load(PropertyMap{"hello": {Property{}}})
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 Convey("errors", func() { 181 Convey("errors", func() {
174 182
175 Convey("weird value", func() { 183 Convey("weird value", func() {
176 pm := PropertyMap{} 184 pm := PropertyMap{}
177 So(pm.SetMeta("sup", complex(100, 20)), ShouldBeFalse) 185 So(pm.SetMeta("sup", complex(100, 20)), ShouldBeFalse)
178 }) 186 })
179 }) 187 })
180 }) 188 })
181 }) 189 })
182 } 190 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698