test.scm 1000 Bytes
Newer Older
Dave Griffiths's avatar
Dave Griffiths committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
#!/usr/bin/env racket
#lang racket

(require
 "scripts/utils.ss"
 "scripts/request.ss"
 "scripts/logger.ss"
 "scripts/json.ss"
 "scripts/sql.ss"
 "scripts/sql.ss"
 "../eavdb/ktv.ss"
 "../eavdb/ktv-list.ss"
 "../eavdb/entity-values.ss"
 "../eavdb/entity-insert.ss"
 "../eavdb/entity-get.ss"
 "../eavdb/entity-update.ss"
 "../eavdb/entity-sync.ss"
 "../eavdb/entity-filter.ss"
 "../eavdb/entity-csv.ss"
 "../eavdb/eavdb.ss"
 "scripts/txt.ss"
 "scripts/server-sync.ss")


(open-log "unit-test-log.txt")


(define (unit-tests)
  ;; db
Dave Griffiths's avatar
Dave Griffiths committed
30 31 32 33 34 35
  (msg "testing db")
  (define db "unit-test.db")
  (with-handlers
   ((exn:fail? (lambda (e) (msg e))))
   (delete-file db))
  (set! db (db-open db setup))
Dave Griffiths's avatar
Dave Griffiths committed
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59


;;(msg (db-status db))

;; test low level sql

(sql-test db)
(ktv-test)

;; test the entity attribute value system
(define table "eavunittest")
(setup db table)

(entity-update-test db table)
(entity-sync-test db table)

(msg (csv db table "thing"))

(msg (db-status db))

(msg "test over...")
)

(unit-tests)