X-Git-Url: https://git.jsancho.org/?p=bongodb.git;a=blobdiff_plain;f=tests%2Fsample.scm;fp=tests%2Fsample.scm;h=047a751ca444e363154adea47b044cee46a6fd96;hp=0000000000000000000000000000000000000000;hb=9799d66d7e1538bbe2a672946ce80b49dc55ca84;hpb=845c98271c1c4e10200ea0d15f6cafabb52d3ea9 diff --git a/tests/sample.scm b/tests/sample.scm new file mode 100644 index 0000000..047a751 --- /dev/null +++ b/tests/sample.scm @@ -0,0 +1,34 @@ +;;; BongoDB, an embedded document-based engine +;;; Copyright (C) 2016 by Javier Sancho Fernandez +;;; +;;; This program is free software: you can redistribute it and/or modify +;;; it under the terms of the GNU General Public License as published by +;;; the Free Software Foundation, either version 3 of the License, or +;;; (at your option) any later version. +;;; +;;; This program is distributed in the hope that it will be useful, +;;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;;; GNU General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with this program. If not, see . + + +(use-modules (bongodb) + (srfi srfi-64)) + +(test-begin "bongodb") + +; Definition +(define col (make-collection)) +(test-assert (collection? col)) + +; Insert +(set! col (insert col '((a . 1) (b . 2)) '((a . 10) (b . 20)) '((a . 1) (b . "hello world")))) +(test-eqv 3 (count col)) + +; Search +(test-eqv 2 (length (find col '((a . 1))))) + +(test-end "bongodb")