Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

begin test suite

  • Loading branch information...
commit 0009248adb1be424d412a1d3851df948f858a167 1 parent 00d4211
@kraison authored
Showing with 63 additions and 0 deletions.
  1. +16 −0 vivace-graph-v2-test.asd
  2. +47 −0 vivace-graph-v2-test.lisp
View
16 vivace-graph-v2-test.asd
@@ -0,0 +1,16 @@
+;; ASDF package description for vivace-graph-v2-test -*- Lisp -*-
+
+(defpackage :vivace-graph-v2-test-system (:use :cl :asdf))
+(in-package :vivace-graph-v2-test-system)
+
+(defsystem vivace-graph-v2-test
+ :name "Vivace Graph Tests"
+ :maintainer "Kevin Raison"
+ :author "Kevin Raison <last name @ chatsubo dot net>"
+ :version "0.2"
+ :description "Vivace Graph Version 2 Test Suite"
+ :long-description "Vivace Graph Version 2 Test Suite."
+ :depends-on (:vivace-graph-v2
+ :fiveam)
+ :components ((:file "vivace-graph-v2-test")))
+
View
47 vivace-graph-v2-test.lisp
@@ -0,0 +1,47 @@
+(in-package #:cl-user)
+
+(defpackage #:vivace-graph-v2-test
+ (:use #:cl #:vivace-graph-v2 #:fiveam)
+ (:export #:run-all-tests
+ #:*test-db-dir*))
+
+(in-package #:vivace-graph-v2-test)
+
+(defparameter *test-db-dir* #P"/var/tmp/vivace-graph-v2-test-db/")
+
+(defun test-select (store)
+ (let ((*store* store))
+ (let ((triple (select-first (?s ?p ?o) (q- ?s ?p ?o))))
+ (and (equal "VGT" (first triple))
+ (equal "is-a" (second triple))
+ (equal "thing" (third triple))))))
+
+(defun run-all-tests ()
+ (fiveam:def-suite vg-test-suite :description "VG Test Suite")
+ (fiveam:in-suite vg-test-suite)
+ (ensure-directories-exist *test-db-dir*)
+ (format t "~%~%Preparing to run all VivaceGraph Tests.~%")
+ (fiveam:test (vg-tests)
+ ;; Basic tests of graph db
+ (fiveam:is (triple-store? (create-triple-store
+ :name "VGT"
+ :location *test-db-dir*)))
+ (fiveam:is (triple-store? *store*))
+ (fiveam:is (equal "VGT" *graph*))
+ (fiveam:is (triple? (add-triple "VGT" "is-a" "thing" :cf 1.0)))
+ (fiveam:is (triple? (first (get-triples-list))))
+ (fiveam:is (test-select *store*))
+ (fiveam:is-false (close-triple-store))
+ (fiveam:is (null *store*))
+ (fiveam:is (triple-store? (open-triple-store
+ :name "VGT"
+ :location *test-db-dir*)))
+ (fiveam:is (triple-store? *store*))
+ (fiveam:is (equal "VGT" *graph*))
+ (fiveam:is (triple? (first (get-triples-list))))
+ (fiveam:is (test-select *store*))
+ (fiveam:is-false (close-triple-store))
+ (fiveam:finishes (cl-fad:delete-directory-and-files *test-db-dir*)))
+ (fiveam:run!)
+ (cl-fad:delete-directory-and-files rfd::*test-db-dir*))
+
Please sign in to comment.
Something went wrong with that request. Please try again.