From: Sebastian Harl Date: Sun, 1 Mar 2015 15:24:35 +0000 (+0100) Subject: parser_test: Test various array expressions. X-Git-Tag: sysdb-0.8.0~149 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=b45b2ab7efd9a202e6a7d450461fa43566b31db5;p=sysdb.git parser_test: Test various array expressions. --- diff --git a/t/unit/frontend/parser_test.c b/t/unit/frontend/parser_test.c index c35ea4e..599ffe5 100644 --- a/t/unit/frontend/parser_test.c +++ b/t/unit/frontend/parser_test.c @@ -252,6 +252,59 @@ struct { { "LOOKUP hosts MATCHING " "backend = ['a','b']", -1, 1, SDB_CONNECTION_LOOKUP }, + /* array iteration */ + { "LOOKUP hosts MATCHING " + "'foo' IN backend", -1, 1, SDB_CONNECTION_LOOKUP }, + { "LOOKUP hosts MATCHING " + "['foo','bar'] " + "IN backend ", -1, 1, SDB_CONNECTION_LOOKUP }, + /* attribute type is unknown */ + { "LOOKUP hosts MATCHING " + "attribute['backend'] " + "IN backend ", -1, 1, SDB_CONNECTION_LOOKUP }, + /* type mismatch */ + { "LOOKUP hosts MATCHING " + "1 IN backend ", -1, -1, 0 }, + { "LOOKUP hosts MATCHING " + "ANY backend < 'b'", -1, 1, SDB_CONNECTION_LOOKUP }, + { "LOOKUP hosts MATCHING " + "ANY backend <= 'b'", -1, 1, SDB_CONNECTION_LOOKUP }, + { "LOOKUP hosts MATCHING " + "ANY backend = 'b'", -1, 1, SDB_CONNECTION_LOOKUP }, + { "LOOKUP hosts MATCHING " + "ANY backend != 'b'", -1, 1, SDB_CONNECTION_LOOKUP }, + { "LOOKUP hosts MATCHING " + "ANY backend >= 'b'", -1, 1, SDB_CONNECTION_LOOKUP }, + { "LOOKUP hosts MATCHING " + "ANY backend > 'b'", -1, 1, SDB_CONNECTION_LOOKUP }, + { "LOOKUP hosts MATCHING " + "ANY backend =~ 'b'", -1, 1, SDB_CONNECTION_LOOKUP }, + { "LOOKUP hosts MATCHING " + "ANY backend !~ 'b'", -1, 1, SDB_CONNECTION_LOOKUP }, + { "LOOKUP hosts MATCHING " + "ALL backend < 'b'", -1, 1, SDB_CONNECTION_LOOKUP }, + { "LOOKUP hosts MATCHING " + "ALL backend <= 'b'", -1, 1, SDB_CONNECTION_LOOKUP }, + { "LOOKUP hosts MATCHING " + "ALL backend = 'b'", -1, 1, SDB_CONNECTION_LOOKUP }, + { "LOOKUP hosts MATCHING " + "ALL backend != 'b'", -1, 1, SDB_CONNECTION_LOOKUP }, + { "LOOKUP hosts MATCHING " + "ALL backend >= 'b'", -1, 1, SDB_CONNECTION_LOOKUP }, + { "LOOKUP hosts MATCHING " + "ALL backend > 'b'", -1, 1, SDB_CONNECTION_LOOKUP }, + { "LOOKUP hosts MATCHING " + "ALL backend =~ 'b'", -1, 1, SDB_CONNECTION_LOOKUP }, + { "LOOKUP hosts MATCHING " + "ALL backend !~ 'b'", -1, 1, SDB_CONNECTION_LOOKUP }, + /* attribute type is unknown */ + { "LOOKUP hosts MATCHING " + "ANY backend = attribute['backend']", + -1, 1, SDB_CONNECTION_LOOKUP }, + /* type mismatch */ + { "LOOKUP hosts MATCHING " + "ANY backend = 1", -1, -1, 0 }, + /* valid operand types */ { "LOOKUP hosts MATCHING " "age * 1 > 0s", -1, 1, SDB_CONNECTION_LOOKUP },