;;;; ;; (import (only (chicken string) ->string)) (define-syntax test-bigO (syntax-rules () ((_ ?O ?expr) (test-bigO (->string ?expr) ?O ?expr) ) ((_ ?msg ?O ?expr) (test-assert ?msg (bigO= ?O ?expr)) ) ) ) ;; (import (chicken time posix)) ;NOTE (sleep i) seems to actually sleep i-1 seconds on windows (define SLEEP-TIME 2) (define (busy-work) (sleep SLEEP-TIME)) ;; (import (only (chicken base) alist-ref)) (define-syntax stats-item (syntax-rules () ((_ ?key ?stats) (stats-ref ?stats '?key) ) ) ) (define (stats-ref stats key) (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) )