Changeset 247 for branches/new-datamodel
- Timestamp:
- 03/22/10 18:49:05 (15 years ago)
- Location:
- branches/new-datamodel/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified branches/new-datamodel/src/model/datamodel.lisp ¶
r246 r247 2693 2693 specific keyword arguments for their purpose." 2694 2694 (declare (symbol class-symbol)) 2695 (when (and (VersionedConstructC-p class-symbol) 2696 (not (getf args :start-revision))) 2697 (error "From make-construct(): start-revision must be set")) 2695 2698 (let ((construct 2696 2699 (cond … … 2708 2711 (apply #'make-association args)) 2709 2712 ((VersionedConstructC-p class-symbol) 2710 (apply #'make-instance (rec-remf args :start-revision))) 2713 (apply #'make-instance class-symbol 2714 (rec-remf args :start-revision))) 2711 2715 (t 2712 2716 (apply #'make-instance class-symbol args)))) … … 2719 2723 :start-revision start-revision)) 2720 2724 (when (typep construct 'VersionedConstructC) 2721 (unless start-revision2722 (error "From make-construct(): start-revision must be set"))2723 2725 (add-to-version-history construct :start-revision start-revision)) 2724 2726 (if (typep construct 'ReifiableConstructC) -
TabularUnified branches/new-datamodel/src/unit_tests/datamodel_test.lisp ¶
r246 r247 60 60 :test-equivalent-TopicMapC 61 61 :test-class-p 62 :test-find-item-by-revision)) 62 :test-find-item-by-revision 63 :test-make-Unknown 64 :test-make-VersionedConstructC)) 63 65 64 66 … … 1875 1877 1876 1878 1879 (test test-make-Unknown () 1880 "Tests the function make-construct corresponding to an unknown class." 1881 (defclass Unknown () 1882 ((value :initarg :value 1883 :accessor value))) 1884 (let ((construct (make-construct 'Unknown :value "value"))) 1885 (is-true construct) 1886 (string= (value construct) "value"))) 1887 1888 1889 (test test-make-VersionedConstructC () 1890 "Tests the function make-construct corresponding to VersionedConstructC." 1891 (with-fixture with-empty-db (*db-dir*) 1892 (let ((psi-1 (make-instance 'PersistentIdC :uri "psi-1")) 1893 (top-1 (make-instance 'TopicC)) 1894 (rev-0 0) 1895 (rev-1 100) 1896 (rev-2 200)) 1897 (let ((vc (make-construct 'VersionedConstructC 1898 :start-revision rev-2)) 1899 (psi-assoc (make-construct 'd::PersistentIdAssociationC 1900 :start-revision rev-1 1901 :identifier psi-1 1902 :parent-construct top-1))) 1903 (signals error (make-construct 'd::PersistentIdAssociationC 1904 :start-revision rev-1 1905 :identifier psi-1)) 1906 (signals error (make-construct 'VersionedConstructC)) 1907 (is (= (length (d::versions vc)) 1)) 1908 (is-true (find-if #'(lambda(vi) 1909 (and (= (d::start-revision vi) rev-2) 1910 (= (d::end-revision vi) rev-0))) 1911 (d::versions vc))) 1912 (is (= (length (d::versions psi-assoc)) 1)) 1913 (is-true (find-if #'(lambda(vi) 1914 (and (= (d::start-revision vi) rev-1) 1915 (= (d::end-revision vi) rev-0))) 1916 (d::versions psi-assoc))))))) 1917 1918 1877 1919 1878 1920 … … 1919 1961 (it.bese.fiveam:run! 'test-class-p) 1920 1962 (it.bese.fiveam:run! 'test-find-item-by-revision) 1963 (it.bese.fiveam:run! 'test-make-Unknown) 1964 (it.bese.fiveam:run! 'test-make-VersionedConstructC) 1921 1965 )
Note: See TracChangeset
for help on using the changeset viewer.