luv

Workshop wiki

tests.lisp

arithmetic/language/tests.lisp

system luv/test · 16 definitions · on GitHub

in-package#:luv.tests
lang:define-arithmetic-functionfog-shape
view-distance:quantity:distance:unit:metre
fog-near:quantity:distance:unit:metre
fog-far:quantity:distance:unit:metre
let*
fog-span
-fog-farfog-near
fog-progress
clamp
/fog-span
quantity0.0:unit:one
quantity1.0:unit:one
interpret
*fog-progressfog-progress
:quantity:proportion:unit:one
lang:define-arithmetic-functionsquare-offset
value
let*
shifted
+value1.0
*shiftedshifted
lang:define-arithmetic-functiontriangular-number
count
counted-fold
indexcountsum0
+sumindex
lang:define-arithmetic-functionbounded-triangular-number
count
limit
counted-fold
indexcountsum0
if
<indexlimit
+sumindex
sum
lang:define-arithmetic-functionfolded-remainders
count
counted-fold
indexcountsum0
let*
next
+index1
remainder
modnext3
+sumremainder
deftestarithmetic-functions-retain-checked-source-graphs
let*
bindings
lang:arithmetic-function-bindingsdefinition
result
lang:arithmetic-function-resultdefinition
specification
lang:arithmetic-expression-quantity-specificationresult
ok
=3
length
lang:arithmetic-function-parametersdefinition
ok
equal'
fog-spanfog-progress
mapcar#'lang:arithmetic-object-namebindings
ok
eq:proportion
math:quantity-specification-namespecification
ok
math:unitless-p
math:quantity-specification-unitspecification
ok
equal'
interpret
*fog-progressfog-progress
:quantity:proportion:unit:one
deftestreusable-functions-are-part-of-the-common-expression-graph
let*
call
first
lang:arithmetic-call-operands
lang:arithmetic-function-resultdefinition
ok
eq'square-offset
lang:arithmetic-object-name
lang:arithmetic-function-call-definitioncall
ok
=1
length
lang:arithmetic-function-call-argumentscall
ok
=2
length
lang:arithmetic-function-call-bindingscall
ok
typep
first
lang:arithmetic-function-call-bindingscall
'lang:arithmetic-function-parameter-binding
deftestcommon-functions-reject-bad-applications
ok
eq:arithmetic-function-arity
handler-case
lang:arithmetic-language-error
condition
lang:arithmetic-language-error-reasoncondition
lang:define-arithmetic-functionrecursion-probe
value
+value1.0
ok
eq:recursive-arithmetic-function
handler-case
progn
lang:parse-arithmetic-function-definition'recursion-probe'
value
'
recursion-probevalue
nil
lang:arithmetic-language-error
condition
lang:arithmetic-language-error-reasoncondition
deftestcounted-fold-is-shared-inspectable-control-flow
let
ok
eq'index
lang:arithmetic-object-name
lang:arithmetic-counted-fold-index-bindingfold
ok
eq'sum
lang:arithmetic-object-name
lang:arithmetic-counted-fold-state-bindingfold
ok
equal'
counted-fold
indexcountsum0
+sumindex
deftestcounted-fold-updates-own-shared-lexical-bindings
let*
bindings
lang:arithmetic-counted-fold-bindingsfold
ok
equal'
nextremainder
mapcar#'lang:arithmetic-object-namebindings
ok
eq'mod
lang:arithmetic-call-operator
lang:arithmetic-binding-expression
secondbindings
deftestconditionals-and-comparisons-are-shared-expression-nodes
let*
conditional
lang:arithmetic-counted-fold-updatefold
ok
ok
equal'
if
<indexlimit
+sumindex
sum
ok
typep
lang:arithmetic-conditional-conditionconditional
'lang:arithmetic-call
deftestarithmetic-functions-reject-semantic-mistakes-before-a-backend
ok
signals
lang:parse-arithmetic-function-definition'bad-addition'
distance:quantity:distance:unit:metre
height:quantity:height:unit:metre
'
'lang:arithmetic-language-error
ok
eq:different-quantity-spaces
handler-case
progn
lang:parse-arithmetic-function-definition'bad-addition'
distance:quantity:distance:unit:metre
height:quantity:height:unit:metre
'
nil
lang:arithmetic-language-error
condition
lang:arithmetic-language-error-detailscondition
deftestunit-conversion-is-an-inspectable-common-expression
let*
result
lang:arithmetic-function-resultdefinition
ok
=1000
lang:arithmetic-unit-conversion-factorresult
ok
math:unit-expression=:metre
math:quantity-specification-unit
lang:arithmetic-expression-quantity-specificationresult
deftestcommon-literals-preserve-source-representation
let*
result
lang:arithmetic-function-resultdefinition
ok
typep
lang:arithmetic-literal-valueresult
'double-float