arithmetic/records/tests.lisp
in-package#:luv.tests
defclassquantity-base-record
position:initarg:position:typevector:quantity
:quantity:distance:unit:metre:tensor-order1
:accessorquantity-record-position:metaclassrecords:quantity-class
defclassquantity-derived-record
:metaclassrecords:quantity-class
defclassquantity-redefined-record
reading:typedouble-float:quantity
:quantity:distance:unit:metre
:metaclassrecords:quantity-class
records:define-quantity-struct
quantity-structure-record
:constructormake-quantity-structure-record
directioncount
direction:typevector:quantity
:unit:one:tensor-order1
count0:typefixnum
deftestclos-slots-retain-effective-quantity-declarations
let*
direct
first
closer-mop:class-direct-slots
find-class'quantity-base-record
ok
ok
ok
ok
eq:distance
math:quantity-specification-name
deftestclos-slot-access-remains-ordinary-raw-access
let*
value
1.0d02.0d03.0d0
record
ok
eqvalue
quantity-record-positionrecord
setf
quantity-record-positionrecord
4.0d05.0d06.0d0
ok
equalp
4.0d05.0d06.0d0
quantity-record-positionrecord
deftestclos-slot-redefinition-replaces-inspectable-quantity-meaning
unwind-protect
progn
eval'
defclassquantity-redefined-record
reading:typedouble-float:quantity
:quantity:height:unit:metre
:metaclassrecords:quantity-class
ok
eq:height
math:quantity-specification-name
eval'
defclassquantity-redefined-record
reading:typedouble-float:quantity
:quantity:distance:unit:metre
:metaclassrecords:quantity-class
deftestconflicting-inherited-quantity-declarations-are-rejected
ok
signals
progn
'records:quantity-slot-conflicteval'
defclassquantity-conflicting-record
position:typevector:quantity
:quantity:height:unit:metre:tensor-order1
:metaclassrecords:quantity-class
deftestdefstruct-retains-layout-and-publishes-the-same-protocol
let*
direction
1.00.00.0
record
make-quantity-structure-recorddirection3
ok
eqdirection
quantity-structure-record-directionrecord
ok
ok
ok
null
defclass quantity-class
A standard class whose annotated slots retain quantity declarations. Slot access and instance representation remain ordinary CLOS. The metaclass only makes definition-time meaning inspectable and inheritable. #OXBSAY
defmacro define-quantity-struct
(name-and-options &body slot-descriptions)Define an ordinary structure whose annotated slots publish quantity meaning. The runtime representation and accessors are still those of DEFSTRUCT. #FLRFU8
defun record-slot-declaration
(record slot-name)defgeneric declaration-representation-type
(declaration)Return DECLARATION's backend or Common Lisp representation type, or NIL.
defun quantity-specification=
(left right)defgeneric declaration-quantity-specification
(declaration)Return DECLARATION's homogeneous quantity specification, or NIL.
defclass declaration
PROPERTY: VALUES; -- the property a keyword, the values a list written space-separated.
define-arithmetic-operator =
Test whether two compatible scalars are equal.
CLOS may defer effective-slot computation until finalization.