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

Unified Diff: impl/memory/datastore_index_test.go

Issue 2342063003: Differentiate between single- and multi- props. (Closed)
Patch Set: Slice is now always a clone. This is marginally worse performance, but a much safer UI. Created 4 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « impl/memory/datastore_index.go ('k') | impl/memory/datastore_query_execution.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: impl/memory/datastore_index_test.go
diff --git a/impl/memory/datastore_index_test.go b/impl/memory/datastore_index_test.go
index e5f2466cd7d7894fc28491bb0b800c1806e6ada9..7f502b76fce4c5ce589ce3d881d34bb1b2a4b902 100644
--- a/impl/memory/datastore_index_test.go
+++ b/impl/memory/datastore_index_test.go
@@ -41,9 +41,9 @@ var rowGenTestCases = []struct {
{
name: "simple including builtins",
pmap: ds.PropertyMap{
- "wat": {propNI("thing"), prop("hat"), prop(100)},
- "nerd": {prop(103.7)},
- "spaz": {propNI(false)},
+ "wat": ds.PropertySlice{propNI("thing"), prop("hat"), prop(100)},
+ "nerd": prop(103.7),
+ "spaz": propNI(false),
},
withBuiltin: true,
idxs: []*ds.IndexDefinition{
@@ -95,12 +95,12 @@ var rowGenTestCases = []struct {
{
name: "complex",
pmap: ds.PropertyMap{
- "yerp": {prop("hat"), prop(73.9)},
- "wat": {
+ "yerp": ds.PropertySlice{prop("hat"), prop(73.9)},
+ "wat": ds.PropertySlice{
prop(rgenComplexTime),
prop([]byte("value")),
prop(rgenComplexKey)},
- "spaz": {prop(nil), prop(false), prop(true)},
+ "spaz": ds.PropertySlice{prop(nil), prop(false), prop(true)},
},
idxs: []*ds.IndexDefinition{
indx("knd", "-wat", "nerd", "spaz"), // doesn't match, so empty
@@ -137,7 +137,7 @@ var rowGenTestCases = []struct {
{
name: "ancestor",
pmap: ds.PropertyMap{
- "wat": {prop("sup")},
+ "wat": prop("sup"),
},
idxs: []*ds.IndexDefinition{
indx("knd!", "wat"),
@@ -215,9 +215,9 @@ func TestIndexRowGen(t *testing.T) {
Convey("defaultIndexes", func() {
pm := ds.PropertyMap{
- "wat": {propNI("thing"), prop("hat"), prop(100)},
- "nerd": {prop(103.7)},
- "spaz": {propNI(false)},
+ "wat": ds.PropertySlice{propNI("thing"), prop("hat"), prop(100)},
+ "nerd": prop(103.7),
+ "spaz": propNI(false),
}
idxs := defaultIndexes("knd", pm)
So(len(idxs), ShouldEqual, 5)
@@ -283,16 +283,16 @@ var updateIndexesTests = []struct {
name: "basic",
data: []dumbItem{
{key("knd", 1), ds.PropertyMap{
- "wat": {prop(10)},
- "yerp": {prop(10)}},
+ "wat": prop(10),
+ "yerp": prop(10)},
},
{key("knd", 10), ds.PropertyMap{
- "wat": {prop(1)},
- "yerp": {prop(200)}},
+ "wat": prop(1),
+ "yerp": prop(200)},
},
{key("knd", 1), ds.PropertyMap{
- "wat": {prop(10)},
- "yerp": {prop(202)}},
+ "wat": prop(10),
+ "yerp": prop(202)},
},
},
expected: map[string][][]byte{
@@ -316,24 +316,24 @@ var updateIndexesTests = []struct {
idxs: []*ds.IndexDefinition{indx("knd", "yerp", "-wat")},
data: []dumbItem{
{key("knd", 1), ds.PropertyMap{
- "wat": {prop(10)},
- "yerp": {prop(100)}},
+ "wat": prop(10),
+ "yerp": prop(100)},
},
{key("knd", 10), ds.PropertyMap{
- "wat": {prop(1)},
- "yerp": {prop(200)}},
+ "wat": prop(1),
+ "yerp": prop(200)},
},
{key("knd", 11), ds.PropertyMap{
- "wat": {prop(20)},
- "yerp": {prop(200)}},
+ "wat": prop(20),
+ "yerp": prop(200)},
},
{key("knd", 14), ds.PropertyMap{
- "wat": {prop(20)},
- "yerp": {prop(200)}},
+ "wat": prop(20),
+ "yerp": prop(200)},
},
{key("knd", 1), ds.PropertyMap{
- "wat": {prop(10)},
- "yerp": {prop(202)}},
+ "wat": prop(10),
+ "yerp": prop(202)},
},
},
expected: map[string][][]byte{
« no previous file with comments | « impl/memory/datastore_index.go ('k') | impl/memory/datastore_query_execution.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698