Adapt scenario to new API.
parent
9c110610ae
commit
fb84d81075
|
@ -1,31 +1,25 @@
|
||||||
(in-package :dodb)
|
(in-package :dodb)
|
||||||
|
|
||||||
;
|
(defstruct vehicle name color (nb-of-lights 4))
|
||||||
; TEST SCENARIO
|
|
||||||
;
|
|
||||||
|
|
||||||
(defstruct vehicle name color (nb_of_lights 4))
|
|
||||||
|
|
||||||
;(defparameter cars (db/new "vehicle" "./storage/cars/"))
|
|
||||||
; to launch the tests in RAM
|
; to launch the tests in RAM
|
||||||
(defparameter cars (db/new "vehicle" "/tmp/storage/cars/"))
|
(defparameter cars (db/new "/tmp/storage/cars/"))
|
||||||
|
|
||||||
(db/add cars (make-vehicle :name "Corvet" :color "Red"))
|
(db/add cars (make-vehicle :name "Corvet" :color "Red"))
|
||||||
(db/add cars (make-vehicle :name "Ferrari" :color "Red"))
|
(db/add cars (make-vehicle :name "Ferrari" :color "Red"))
|
||||||
(db/add cars (make-vehicle :name "Deudeuch" :color "Beige"))
|
(db/add cars (make-vehicle :name "Deudeuch" :color "Beige"))
|
||||||
(db/add cars (make-vehicle :name "BMW" :color "Blue"))
|
(db/add cars (make-vehicle :name "BMW" :color "Blue"))
|
||||||
(db/add cars (make-vehicle :name "Suzuki Wagon" :color "Blue" :nb_of_lights 6))
|
(db/add cars (make-vehicle :name "Suzuki Wagon" :color "Blue" :nb-of-lights 6))
|
||||||
|
|
||||||
(db/new-index cars "name")
|
|
||||||
(db/new-partition cars "color")
|
|
||||||
(db/new-partition cars "nb_of_lights")
|
|
||||||
|
|
||||||
|
(db/new-index cars "name" #'vehicle-name)
|
||||||
|
(db/new-partition cars "color" #'vehicle-color)
|
||||||
|
(db/new-partition cars "nb-of-lights" #'vehicle-nb-of-lights)
|
||||||
|
|
||||||
(format t "~&~S~&" cars)
|
(format t "~&~S~&" cars)
|
||||||
|
|
||||||
(format t "db/get-by-index ~S~&" (db/get-by-index cars "name" "Corvet"))
|
(format t "db/get-by-index ~S~&" (db/get-by-index cars "name" "Corvet"))
|
||||||
(format t "db/get-by-partition red cars:~&")
|
|
||||||
|
|
||||||
|
(format t "db/get-by-partition red cars:~&")
|
||||||
(loop for car in (db/get-by-partition cars "color" "Red")
|
(loop for car in (db/get-by-partition cars "color" "Red")
|
||||||
do (format t "- ~S~&" car))
|
do (format t "- ~S~&" car))
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue