Skip to content

Commit

Permalink
Add more tests for &!
Browse files Browse the repository at this point in the history
refs #1372
  • Loading branch information
kou committed May 25, 2012
1 parent 0e7ab5d commit 35b7696
Show file tree
Hide file tree
Showing 9 changed files with 229 additions and 2 deletions.
10 changes: 8 additions & 2 deletions test/function/files.am
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,10 @@ test_files = \
suite/select/filter/geo_in_circle/sphr_without_index.test \
suite/select/filter/geo_in_circle/with_index.test \
suite/select/filter/geo_in_circle/without_index.test \
suite/select/filter/set_operation/not_and.test \
suite/select/filter/set_operation/not_and/and.test \
suite/select/filter/set_operation/not_and/not_and.test \
suite/select/filter/set_operation/not_and/or.test \
suite/select/filter/set_operation/not_and/single_expression.test \
suite/select/filter/similar.test \
suite/select/output-columns/with-space.test \
suite/select/output/scalar-reference-default.test \
Expand Down Expand Up @@ -80,7 +83,10 @@ expected_files = \
suite/select/filter/geo_in_circle/sphr_without_index.expected \
suite/select/filter/geo_in_circle/with_index.expected \
suite/select/filter/geo_in_circle/without_index.expected \
suite/select/filter/set_operation/not_and.expected \
suite/select/filter/set_operation/not_and/and.expected \
suite/select/filter/set_operation/not_and/not_and.expected \
suite/select/filter/set_operation/not_and/or.expected \
suite/select/filter/set_operation/not_and/single_expression.expected \
suite/select/filter/similar.expected \
suite/select/output-columns/with-space.expected \
suite/select/output/scalar-reference-default.expected \
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
table_create Tags TABLE_HASH_KEY ShortText
[[0,0.0,0.0],true]
table_create Movies TABLE_HASH_KEY ShortText
[[0,0.0,0.0],true]
column_create Movies tags COLUMN_VECTOR Tags
[[0,0.0,0.0],true]
column_create Tags index COLUMN_INDEX Movies tags
[[0,0.0,0.0],true]
load --table Movies
[
{"_key": "Seven Samurai", tags: ["Samurai", "Japanese", "Kurosawa Akira"]},
{"_key": "The Last Samurai", tags: ["Samurai", "English", "Tom Cruise"]},
{"_key": "The Matrix", tags: ["Keanu Reeves", "SF", "English"]},
{"_key": "Star Wars", tags: ["George Lucas", "SF", "English"]}
]
[[0,0.0,0.0],4]
select Movies --filter 'tags @ "English" &! (tags @ "SF" &! tags @ "Keanu Reeves")'
[
[
0,
0.0,
0.0
],
[
[
[
2
],
[
[
"_id",
"UInt32"
],
[
"_key",
"ShortText"
],
[
"tags",
"Tags"
]
],
[
2,
"The Last Samurai",
[
"Samurai",
"English",
"Tom Cruise"
]
],
[
3,
"The Matrix",
[
"Keanu Reeves",
"SF",
"English"
]
]
]
]
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
table_create Tags TABLE_HASH_KEY ShortText

table_create Movies TABLE_HASH_KEY ShortText
column_create Movies tags COLUMN_VECTOR Tags

column_create Tags index COLUMN_INDEX Movies tags

load --table Movies
[
{"_key": "Seven Samurai", tags: ["Samurai", "Japanese", "Kurosawa Akira"]},
{"_key": "The Last Samurai", tags: ["Samurai", "English", "Tom Cruise"]},
{"_key": "The Matrix", tags: ["Keanu Reeves", "SF", "English"]},
{"_key": "Star Wars", tags: ["George Lucas", "SF", "English"]}
]

select Movies \
--filter 'tags @ "English" &! (tags @ "SF" &! tags @ "Keanu Reeves")'
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
table_create Tags TABLE_HASH_KEY ShortText
[[0,0.0,0.0],true]
table_create Movies TABLE_HASH_KEY ShortText
[[0,0.0,0.0],true]
column_create Movies tags COLUMN_VECTOR Tags
[[0,0.0,0.0],true]
column_create Tags index COLUMN_INDEX Movies tags
[[0,0.0,0.0],true]
load --table Movies
[
{"_key": "Seven Samurai", tags: ["Samurai", "Japanese", "Kurosawa Akira"]},
{"_key": "The Last Samurai", tags: ["Samurai", "English", "Tom Cruise"]},
{"_key": "The Matrix", tags: ["Keanu Reeves", "SF", "English"]},
{"_key": "Star Wars", tags: ["George Lucas", "SF", "English"]}
]
[[0,0.0,0.0],4]
select Movies --filter 'tags @ "English" &! (tags @ "Keanu Reeves" || tags @ "George Lucas")'
[
[
0,
0.0,
0.0
],
[
[
[
1
],
[
[
"_id",
"UInt32"
],
[
"_key",
"ShortText"
],
[
"tags",
"Tags"
]
],
[
2,
"The Last Samurai",
[
"Samurai",
"English",
"Tom Cruise"
]
]
]
]
]
17 changes: 17 additions & 0 deletions test/function/suite/select/filter/set_operation/not_and/or.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
table_create Tags TABLE_HASH_KEY ShortText

table_create Movies TABLE_HASH_KEY ShortText
column_create Movies tags COLUMN_VECTOR Tags

column_create Tags index COLUMN_INDEX Movies tags

load --table Movies
[
{"_key": "Seven Samurai", tags: ["Samurai", "Japanese", "Kurosawa Akira"]},
{"_key": "The Last Samurai", tags: ["Samurai", "English", "Tom Cruise"]},
{"_key": "The Matrix", tags: ["Keanu Reeves", "SF", "English"]},
{"_key": "Star Wars", tags: ["George Lucas", "SF", "English"]}
]

select Movies \
--filter 'tags @ "English" &! (tags @ "Keanu Reeves" || tags @ "George Lucas")'
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
table_create Tags TABLE_HASH_KEY ShortText
[[0,0.0,0.0],true]
table_create Movies TABLE_HASH_KEY ShortText
[[0,0.0,0.0],true]
column_create Movies tags COLUMN_VECTOR Tags
[[0,0.0,0.0],true]
column_create Tags index COLUMN_INDEX Movies tags
[[0,0.0,0.0],true]
load --table Movies
[
{"_key": "Seven Samurai", tags: ["Samurai", "Japanese", "Kurosawa Akira"]},
{"_key": "The Last Samurai", tags: ["Samurai", "English", "Tom Cruise"]},
{"_key": "The Matrix", tags: ["Keanu Reeves", "SF", "English"]},
{"_key": "Star Wars", tags: ["George Lucas", "SF", "English"]}
]
[[0,0.0,0.0],4]
select Movies --filter 'tags @ "English" &! tags @ "SF"'
[
[
0,
0.0,
0.0
],
[
[
[
1
],
[
[
"_id",
"UInt32"
],
[
"_key",
"ShortText"
],
[
"tags",
"Tags"
]
],
[
2,
"The Last Samurai",
[
"Samurai",
"English",
"Tom Cruise"
]
]
]
]
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
table_create Tags TABLE_HASH_KEY ShortText

table_create Movies TABLE_HASH_KEY ShortText
column_create Movies tags COLUMN_VECTOR Tags

column_create Tags index COLUMN_INDEX Movies tags

load --table Movies
[
{"_key": "Seven Samurai", tags: ["Samurai", "Japanese", "Kurosawa Akira"]},
{"_key": "The Last Samurai", tags: ["Samurai", "English", "Tom Cruise"]},
{"_key": "The Matrix", tags: ["Keanu Reeves", "SF", "English"]},
{"_key": "Star Wars", tags: ["George Lucas", "SF", "English"]}
]

select Movies --filter 'tags @ "English" &! tags @ "SF"'

0 comments on commit 35b7696

Please sign in to comment.