;;;; (include-relative "../bigO") (import bigO) ;; (define-syntax test-bigO (syntax-rules () ((_ ?O ?expr) (let ((_expr ?expr)) (import (only (chicken string) ->string)) (test-bigO (->string _expr) ?O _expr) ) ) ((_ ?msg ?O ?expr) (begin ;(gloss 'test-bigO '?O ?O '?expr ?expr) (test-assert ?msg (bigO= ?O ?expr))) ) ) ) ;; (define-syntax stats-item (syntax-rules () ((stats-item ?key ?stats) (stats-ref ?stats '?key)) ) ) (define (stats-ref stats key) (import (only (chicken base) alist-ref)) (alist-ref key stats) ) (define (bigO-stats-test expO stats key) (test-bigO (symbol->string key) expO (stats-ref stats key)) ) (define (bigO-stats-tests expO stats #!optional (keys (map car stats))) (for-each (cut bigO-stats-test expO stats <>) keys) )