| OLD | NEW |
| 1 // Copyright 2015 The LUCI Authors. All rights reserved. | 1 // Copyright 2015 The LUCI Authors. All rights reserved. |
| 2 // Use of this source code is governed under the Apache License, Version 2.0 | 2 // Use of this source code is governed under the Apache License, Version 2.0 |
| 3 // that can be found in the LICENSE file. | 3 // that can be found in the LICENSE file. |
| 4 | 4 |
| 5 package memory | 5 package memory |
| 6 | 6 |
| 7 import ( | 7 import ( |
| 8 "testing" | 8 "testing" |
| 9 | 9 |
| 10 . "github.com/smartystreets/goconvey/convey" | 10 . "github.com/smartystreets/goconvey/convey" |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 ret := store.GetOrCreateCollection("") | 103 ret := store.GetOrCreateCollection("") |
| 104 for _, i := range fill { | 104 for _, i := range fill { |
| 105 ret.Set(i.k, i.v) | 105 ret.Set(i.k, i.v) |
| 106 } | 106 } |
| 107 return store.Snapshot().GetCollection("") | 107 return store.Snapshot().GetCollection("") |
| 108 } | 108 } |
| 109 | 109 |
| 110 func TestCollision(t *testing.T) { | 110 func TestCollision(t *testing.T) { |
| 111 t.Parallel() | 111 t.Parallel() |
| 112 | 112 |
| 113 » Convey("Test gkvCollide", t, func() { | 113 » Convey("Test memStoreCollide", t, func() { |
| 114 for _, tc := range testCollisionCases { | 114 for _, tc := range testCollisionCases { |
| 115 Convey(tc.name, func() { | 115 Convey(tc.name, func() { |
| 116 left := getFilledColl(tc.left) | 116 left := getFilledColl(tc.left) |
| 117 right := getFilledColl(tc.right) | 117 right := getFilledColl(tc.right) |
| 118 i := 0 | 118 i := 0 |
| 119 » » » » gkvCollide(left, right, func(key, left, right []
byte) { | 119 » » » » memStoreCollide(left, right, func(key, left, rig
ht []byte) { |
| 120 e := tc.expect[i] | 120 e := tc.expect[i] |
| 121 So(key, ShouldResemble, e.key) | 121 So(key, ShouldResemble, e.key) |
| 122 So(left, ShouldResemble, e.left) | 122 So(left, ShouldResemble, e.left) |
| 123 So(right, ShouldResemble, e.right) | 123 So(right, ShouldResemble, e.right) |
| 124 i++ | 124 i++ |
| 125 }) | 125 }) |
| 126 So(i, ShouldEqual, len(tc.expect)) | 126 So(i, ShouldEqual, len(tc.expect)) |
| 127 }) | 127 }) |
| 128 } | 128 } |
| 129 }) | 129 }) |
| 130 } | 130 } |
| OLD | NEW |