lmdb

Check-in [f971d52bba]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Initial test suite
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: f971d52bba3ba89d0af23fc189dbc5aa63139ac826e472a630cc6c72d836f666
User & Date: murphy 2018-08-20 22:04:26
Context
2018-08-25
12:58
Stale transaction cleanup check-in: b91e1e29c7 user: murphy tags: trunk
2018-08-20
22:04
Initial test suite check-in: f971d52bba user: murphy tags: trunk
22:04
Simplified and corrected database->alist check-in: d177d483aa user: murphy tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to lmdb.egg.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
((category db)
 (synopsis "Bindings to LMDB")
 (author "Thomas Chust")
 (license "OpenLDAP")
 (version "0.1.0")
 (dependencies
   srfi-1)
 (test-dependencies
   test)
 (components
   (extension lmdb
     (custom-build "build-lmdb")
     (source-dependencies "lmdb.h" "mdb.impl.c" "midl.h" "midl.impl.c"))))

;; vim: set ai et ts=8 sts=2 sw=2 ft=scheme: ;;




|










1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
((category db)
 (synopsis "Bindings to LMDB")
 (author "Thomas Chust")
 (license "OpenLDAP")
 (version "1.0.0")
 (dependencies
   srfi-1)
 (test-dependencies
   test)
 (components
   (extension lmdb
     (custom-build "build-lmdb")
     (source-dependencies "lmdb.h" "mdb.impl.c" "midl.h" "midl.impl.c"))))

;; vim: set ai et ts=8 sts=2 sw=2 ft=scheme: ;;

Added tests/run.scm.





















































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
(import 
  lmdb test)

(test-assert "environment creation"
  (database-environment?
   (open-database-environment
    "test-env" #:max-databases 4)))

(define blurbs
  (with-transaction
   (cut open-database "blurbs" #:create)))

(test-assert (database? blurbs))

(with-transaction
 (lambda ()
   (database-set! blurbs "foo" "bar")
   (database-set! blurbs "baz" "kawumm")))

(with-transaction
 (lambda ()
   (test "bar" (database-ref blurbs "foo"))
   (test "kawumm" (database-ref blurbs "baz"))

   (test-assert (database-exists? blurbs "foo"))
   (test-assert (not (database-exists? blurbs "garbage")))

   (test #f (database-ref blurbs "no key" #f))
   (test
     'exn-db
     (condition-case (database-ref blurbs "still no key")
      ((exn db) 'exn-db)))

   (test
     '(("baz" . "kawumm") ("foo" . "bar"))
     (database->alist blurbs)))
 #:read-only)

(define quirks
  (with-transaction
   (cut alist->database
        '(("alpha" . "bravo")
          ("bar" . "foo")
          ("baz" "badumm" "kawumm")
          ("ignored")
          ("xyzzy" . "abracadabra"))
        "quirks" #:create #:duplicate-sort #:append/duplicate)))

(test-assert (database? quirks))

(with-transaction
 (lambda ()
   (test
     '(("bar" . "foo") ("baz" . "badumm") ("baz" . "kawumm"))
     (database->alist quirks #:from "b" #:to< "x"))
   (test
     '(("bar" "foo") ("baz" "badumm" "kawumm"))
     (database->alist quirks #:from "b" #:to< "x" #:duplicate-list))
   
   (database-delete! quirks "baz" "badumm")
   
   (test
     '(("baz" . "kawumm"))
     (database->alist quirks #:from "baz" #:to<= "baz"))
   
   (drop-database quirks)
   
   (test
     '()
     (database->alist quirks))))

(close-database-environment)

(test-exit)