(define-test-module (test module sph storage dg one) (import (sph common) (only (rnrs base) set!) (sph storage dg) (except (rnrs hashtables) ht-ref) (sph storage dg one) (sph two) (test helper sph storage dg) (srfi srfi-41)) (define test-env) (define (test-env-init) (set! test-env (hashtable)) (each (l (key) (ht-set! test-env key (dg-ensure-intern (symbol->string key)))) (q (a b c d e)))) (define-test (dg-tree-interns->ide inp exp) (let (exp (any-ht-keys->values test-env exp)) (dg-ensure-interns (map-integers 8 number->string)) (dg-tree-interns->ide inp))) (define-test (dg-tree-ensure-compound-interns input expected) (let (expected (any-ht-keys->values test-env exp)) (equal? (dg-tree-ensure-compound-interns input) expected))) (define-test (dg-create-extern-from-filesystem-path) (let (path (tmpnam)) (call-with-output-file path (l (port) (display "test" port))) (let (ide (dg-create-extern-from-filesystem-path path)) (and (integer? ide) (file-exists? (dg-ide->path ide)))))) (define-procedure-tests tests (dg-tree-interns->ide ("a" ("b" ("c" "d") "e")) (a (b (c d) e)) () ()) (dg-tree-ensure-compound-interns (("a" ("b" ("c" "d") "e"))) (a (b (c d) e))) dg-create-extern-from-filesystem-path) (define (update-test-settings s) (alist-set-multiple-q s hook (alist-q procedure-before (l a (test-env-dg-reset) (if (not (dg-index-no-errors? (or (dg-index-errors-intern) (dg-index-errors-pair)))) (throw (q index-corruption)))) procedure-after (l a (dg-exit))))) (l (settings) (test-execute-procedures (update-test-settings settings) tests)))