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

Side by Side Diff: service/datastore/serialize/serialize_test.go

Issue 1365743002: Refactor serialization helpers from impl/memory -> service/datastore/serialize (Closed) Base URL: https://github.com/luci/gae.git@estimate_size
Patch Set: fix comments Created 5 years, 2 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 | « service/datastore/serialize/serialize.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 serialize 5 package serialize
6 6
7 import ( 7 import (
8 "bytes" 8 "bytes"
9 "fmt" 9 "fmt"
10 "io" 10 "io"
(...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after
465 for i := 0; i < MaxIndexColumns+1; i++ { 465 for i := 0; i < MaxIndexColumns+1; i++ {
466 id.SortBy = append(id.SortBy, ds.IndexCo lumn{Property: "Hi", Descending: true}) 466 id.SortBy = append(id.SortBy, ds.IndexCo lumn{Property: "Hi", Descending: true})
467 } 467 }
468 data := ToBytes(*id.PrepForIdxTable()) 468 data := ToBytes(*id.PrepForIdxTable())
469 newID, err = ReadIndexDefinition(mkBuf(data)) 469 newID, err = ReadIndexDefinition(mkBuf(data))
470 So(err, ShouldErrLike, "over 64 sort orders") 470 So(err, ShouldErrLike, "over 64 sort orders")
471 }) 471 })
472 }) 472 })
473 }) 473 })
474 } 474 }
475
476 func TestPartialSerialization(t *testing.T) {
477 t.Parallel()
478
479 fakeKey := mkKey("dev~app", "ns", "parentKind", "sid", "knd", 10)
480
481 Convey("TestPartialSerialization", t, func() {
482 Convey("list", func() {
483 pm := ds.PropertyMap{
484 "wat": {mpNI("thing"), mp("hat"), mp(100)},
485 "nerd": {mp(103.7)},
486 "spaz": {mpNI(false)},
487 }
488 sip := PropertyMapPartially(fakeKey, pm)
489 So(len(sip), ShouldEqual, 4)
490
491 Convey("single collated", func() {
492 Convey("indexableMap", func() {
493 So(sip, ShouldResemble, SerializedPmap{
494 "wat": {
495 ToBytes(mp("hat")),
496 ToBytes(mp(100)),
497 // 'thing' is skipped, b ecause it's not NoIndex
498 },
499 "nerd": {
500 ToBytes(mp(103.7)),
501 },
502 "__key__": {
503 ToBytes(mp(fakeKey)),
504 },
505 "__ancestor__": {
506 ToBytes(mp(fakeKey)),
507 ToBytes(mp(fakeKey.Paren t())),
508 },
509 })
510 })
511 })
512 })
513 })
514 }
OLDNEW
« no previous file with comments | « service/datastore/serialize/serialize.go ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698