Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
citizen-science
symbai
Commits
302b38d7
Commit
302b38d7
authored
May 01, 2014
by
Dave Griffiths
Browse files
added unit tests
parent
f0786e6c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
73 additions
and
0 deletions
+73
-0
web/test.scm
web/test.scm
+73
-0
No files found.
web/test.scm
0 → 100755
View file @
302b38d7
#
!/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"
)
(
define
(
db-open
db-name
)
(
cond
((
file-exists?
(
string->path
db-name
))
(
display
"open existing db"
)(
newline
)
(
open
(
string->path
db-name
)))
(
else
(
display
"making new db"
)(
newline
)
(
let
((
db
(
open
(
string->path
db-name
))))
;; todo, dynamically create these tables
(
setup
db
"sync"
)
(
setup
db
"stream"
)
db
))))
(
define
db-name
"unit-test.db"
)
(
with-handlers
((
exn:fail?
(
lambda
(
e
)
(
msg
e
))))
(
delete-file
db-name
))
(
define
db
(
db-open
db-name
))
(
open-log
"unit-test-log.txt"
)
(
define
(
unit-tests
)
;; db
(
msg
"testing db"
)
(
define
db
"unit-test.db"
)
(
set!
db
(
db-open
db
))
;;(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
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment