OLD | NEW |
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 "fmt" | 8 "fmt" |
9 "strings" | 9 "strings" |
10 "testing" | 10 "testing" |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 }, | 131 }, |
132 expect: []qExpect{ | 132 expect: []qExpect{ |
133 {q: nq("Kind"), get: stage1Data[:4]}, | 133 {q: nq("Kind"), get: stage1Data[:4]}, |
134 | 134 |
135 {q: nq("Kind").Offset(2).Limit(1), get: []ds.Pro
pertyMap{ | 135 {q: nq("Kind").Offset(2).Limit(1), get: []ds.Pro
pertyMap{ |
136 stage1Data[2], | 136 stage1Data[2], |
137 }}, | 137 }}, |
138 | 138 |
139 {q: nq("Missing"), get: []ds.PropertyMap{}}, | 139 {q: nq("Missing"), get: []ds.PropertyMap{}}, |
140 | 140 |
141 {q: nq("Missing").Lt("Id", 2).Gt("Id", 2), get:
[]ds.PropertyMap{}}, | |
142 | |
143 {q: nq("Missing").Eq("Bogus", 3), get: []ds.Prop
ertyMap{}}, | 141 {q: nq("Missing").Eq("Bogus", 3), get: []ds.Prop
ertyMap{}}, |
144 | 142 |
145 {q: nq("Kind").Eq("Extra", "waffle"), get: []ds.
PropertyMap{ | 143 {q: nq("Kind").Eq("Extra", "waffle"), get: []ds.
PropertyMap{ |
146 stage1Data[2], stage1Data[3], | 144 stage1Data[2], stage1Data[3], |
147 }}, | 145 }}, |
148 | 146 |
149 // get ziggy with it | 147 // get ziggy with it |
150 {q: nq("Kind").Eq("Extra", "waffle").Eq("Val", 1
00), get: []ds.PropertyMap{ | 148 {q: nq("Kind").Eq("Extra", "waffle").Eq("Val", 1
00), get: []ds.PropertyMap{ |
151 stage1Data[2], | 149 stage1Data[2], |
152 }}, | 150 }}, |
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
465 count, err := data.Count(q) | 463 count, err := data.Count(q) |
466 So(err, ShouldErrLike, "Insufficient indexes") | 464 So(err, ShouldErrLike, "Insufficient indexes") |
467 | 465 |
468 testing.AutoIndex(true) | 466 testing.AutoIndex(true) |
469 | 467 |
470 count, err = data.Count(q) | 468 count, err = data.Count(q) |
471 So(err, ShouldBeNil) | 469 So(err, ShouldBeNil) |
472 So(count, ShouldEqual, 2) | 470 So(count, ShouldEqual, 2) |
473 }) | 471 }) |
474 } | 472 } |
OLD | NEW |