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

Side by Side Diff: go/src/infra/gae/libs/wrapper/memory/testing_utils_test.go

Issue 1229503007: Roll infra/go/src/github.com/luci/luci-go/ to b85c6dd748361e8244122faac44b5beefcd2db37. (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: fix tests 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 unified diff | Download patch
« no previous file with comments | « go/src/infra/gae/libs/wrapper/memory/plist.go ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 memory 5 package memory
6 6
7 import ( 7 import (
8 "bytes" 8 "bytes"
9 "fmt" 9 "fmt"
10 "reflect" 10 "reflect"
11 "time" 11 "time"
12 12
13 "appengine/datastore" 13 "appengine/datastore"
14 14
15 » "github.com/luci/luci-go/common/funnybase" 15 » "github.com/luci/luci-go/common/cmpbin"
16 ) 16 )
17 17
18 type kv struct{ k, v []byte } 18 type kv struct{ k, v []byte }
19 19
20 func indx(kind string, orders ...string) *qIndex { 20 func indx(kind string, orders ...string) *qIndex {
21 ancestor := false 21 ancestor := false
22 if kind[len(kind)-1] == '!' { 22 if kind[len(kind)-1] == '!' {
23 ancestor = true 23 ancestor = true
24 kind = kind[:len(kind)-1] 24 kind = kind[:len(kind)-1]
25 } 25 }
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 } 74 }
75 } 75 }
76 76
77 // cat is a convenience method for concatenating anything with an underlying 77 // cat is a convenience method for concatenating anything with an underlying
78 // byte representation into a single []byte. 78 // byte representation into a single []byte.
79 func cat(bytethings ...interface{}) []byte { 79 func cat(bytethings ...interface{}) []byte {
80 buf := &bytes.Buffer{} 80 buf := &bytes.Buffer{}
81 for _, thing := range bytethings { 81 for _, thing := range bytethings {
82 switch x := thing.(type) { 82 switch x := thing.(type) {
83 case int, int64: 83 case int, int64:
84 » » » funnybase.Write(buf, reflect.ValueOf(x).Int()) 84 » » » cmpbin.WriteInt(buf, reflect.ValueOf(x).Int())
85 case uint, uint64: 85 case uint, uint64:
86 » » » funnybase.WriteUint(buf, reflect.ValueOf(x).Uint()) 86 » » » cmpbin.WriteUint(buf, reflect.ValueOf(x).Uint())
87 case float64: 87 case float64:
88 writeFloat64(buf, x) 88 writeFloat64(buf, x)
89 case byte, propValType: 89 case byte, propValType:
90 buf.WriteByte(byte(reflect.ValueOf(x).Uint())) 90 buf.WriteByte(byte(reflect.ValueOf(x).Uint()))
91 case []byte, serializedPval: 91 case []byte, serializedPval:
92 buf.Write(reflect.ValueOf(x).Convert(byteSliceType).Inte rface().([]byte)) 92 buf.Write(reflect.ValueOf(x).Convert(byteSliceType).Inte rface().([]byte))
93 case string: 93 case string:
94 writeString(buf, x) 94 writeString(buf, x)
95 case time.Time: 95 case time.Time:
96 writeTime(buf, x) 96 writeTime(buf, x)
(...skipping 16 matching lines...) Expand all
113 ret := cat(bytethings...) 113 ret := cat(bytethings...)
114 for i := range ret { 114 for i := range ret {
115 ret[i] ^= 0xFF 115 ret[i] ^= 0xFF
116 } 116 }
117 return ret 117 return ret
118 } 118 }
119 119
120 func sat(bytethings ...interface{}) string { 120 func sat(bytethings ...interface{}) string {
121 return string(cat(bytethings...)) 121 return string(cat(bytethings...))
122 } 122 }
OLDNEW
« no previous file with comments | « go/src/infra/gae/libs/wrapper/memory/plist.go ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698