-
Notifications
You must be signed in to change notification settings - Fork 0
/
idcheck-db-test.ss
39 lines (30 loc) · 1.04 KB
/
idcheck-db-test.ss
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
30
31
32
33
34
35
36
37
38
39
#lang scheme/base
(require "idcheck-db.ss"
"test-base.ss")
(define dummy-key "12345678901234567890123456789012")
(define idcheck-db-tests
(test-suite "All tests for idcheck-db"
(test-case "Added users are found"
(let ((data "foo"))
(after
(add-user! dummy-key data)
(check-equal? (lookup-user dummy-key)
data)
(remove-user! dummy-key))))
(test-case "Removed users are removed"
(let ((data "foo"))
(add-user! dummy-key data)
(check-equal? (lookup-user dummy-key)
data)
(remove-user! dummy-key)
(check-false (lookup-user dummy-key))))
(test-case "Non-numeric keys raise an exception"
(check-exn exn:idcheck?
(lambda ()
(add-user! "foobar" "foo"))))
(test-case "get-username returns username"
(check-equal?
(get-username "OK\nusername\nsome stuff\nmorestuff")
"username"))))
; Provide statements -----------------------------
(provide idcheck-db-tests)