static void tst1(void) { cql_transform_t ct = cql_transform_create(); YAZ_CHECK(compare(ct, "abc", "abc")); YAZ_CHECK(compare(ct, "\"a b c\"", "\"a b c\"")); YAZ_CHECK(compare(ct, "@and a b", "a and b")); YAZ_CHECK(compare(ct, "@attr 1=field abc", "field=abc")); YAZ_CHECK(compare(ct, "@attr 1=4 abc", 0)); /* should fail */ cql_transform_define_pattern(ct, "index.title", "1=4"); YAZ_CHECK(compare(ct, "@attr 1=4 abc", "title=abc")); cql_transform_define_pattern(ct, "index.foo", "1=bar"); YAZ_CHECK(compare(ct, "@attr 1=bar abc", "foo=abc")); cql_transform_close(ct); }
static void tst1(void) { cql_transform_t ct = cql_transform_create(); YAZ_CHECK(compare(ct, "abc", "abc")); YAZ_CHECK(compare(ct, "\"a b c\"", "\"a b c\"")); YAZ_CHECK(compare(ct, "@and a b", "a and b")); YAZ_CHECK(compare(ct, "@or a @and b c", "a or (b and c)")); YAZ_CHECK(compare(ct, "@or @and a b @and c d", "(a and b) or (c and d)")); YAZ_CHECK(compare(ct, "@or @or a b @or c d", "(a or b) or (c or d)")); YAZ_CHECK(compare(ct, "@and @and a b @and c d", "(a and b) and (c and d)")); YAZ_CHECK(compare(ct, "@attr 1=field abc", "field=abc")); YAZ_CHECK(compare2(ct, "@attr 1=4 abc", 0, 114)); /* should fail */ cql_transform_define_pattern(ct, "index.title", "1=4"); YAZ_CHECK(compare(ct, "@attr 1=4 abc", "title=abc")); cql_transform_define_pattern(ct, "index.foo", "1=bar"); YAZ_CHECK(compare(ct, "@attr 1=bar abc", "foo=abc")); cql_transform_close(ct); }