@@ -20,19 +20,22 @@ (string-search (regexp "No such file or directory")(car reslst)))) ;;====================================================================== ;; T E S T M A T C H I N G ;;====================================================================== + +;; tests:glob-like-match (test #f '("abc") (tests:glob-like-match "abc" "abc")) (for-each (lambda (patt str expected) (test (conc patt " " str "=>" expected) expected (tests:glob-like-match patt str))) (list "abc" "~abc" "~abc" "a*c" "a%c") (list "abc" "abcd" "abc" "ABC" "ABC") (list '("abc") #t #f #f '("ABC")) ) +;; tests:match (test #f #t (tests:match "abc/def" "abc" "def")) (for-each (lambda (patterns testname itempath expected) (test (conc patterns " " testname "/" itempath "=>" expected) expected @@ -39,10 +42,23 @@ (tests:match patterns testname itempath))) (list "abc" "abc/%" "ab%/c%" "~abc/c%" "abc/~c%" "a,b/c,%/d") (list "abc" "abc" "abcd" "abc" "abc" "a" ) (list "" "" "cde" "cde" "cde" "" ) (list #t #t #t #f #f #t)) + +;; db:patt->like +(test #f "testname LIKE 't%'" (db:patt->like "testname" "t%" comparator: " AND ")) +(test #f "testname LIKE 't%' AND testname LIKE '%t'" (db:patt->like "testname" "t%,%t" comparator: " AND ")) +(test #f "item_path GLOB ''" (db:patt->like "item_path" "")) + +;; test:match->sqlqry +(test #f "(testname GLOB 'a' AND item_path GLOB 'b') OR (testname LIKE 'a%' AND item_path LIKE '%') OR (testname GLOB '' AND item_path LIKE 'b%')" + (tests:match->sqlqry "a/b,a%,/b%")) +(test #f "(testname GLOB 'a' AND item_path GLOB 'b') OR (testname LIKE 'a%' AND item_path LIKE '%') OR (testname LIKE '%' AND item_path LIKE 'b%')" + (tests:match->sqlqry "a/b,a%,%/b%")) + +;; (exit) ;;====================================================================== ;; C O N F I G F I L E S ;;====================================================================== @@ -229,10 +245,12 @@ (file-exists? "../simpleruns/key1/key2/myrun/test1/testdat.db"))) (test "Get steps for test" #t (> (length (db:get-steps-for-test db test-id)) 0)) (test "Get nice table for steps" "2.0s" (begin (vector-ref (hash-table-ref (db:get-steps-table db test-id) "step1") 4))) + +(exit) ;;====================================================================== ;; R E M O T E C A L L S ;;======================================================================