compiler.tree.*: new tests

db4
Björn Lindqvist 2015-09-20 11:44:52 +02:00
parent b9ce4910af
commit ea67379751
4 changed files with 55 additions and 3 deletions

View File

@ -1,4 +1,4 @@
USING: accessors compiler.tree.builder compiler.tree.propagation
USING: accessors assocs compiler.tree.builder compiler.tree.propagation
compiler.tree.propagation.inlining kernel math sequences tools.test ;
IN: compiler.tree.propagation.inlining.tests
@ -6,3 +6,8 @@ IN: compiler.tree.propagation.inlining.tests
[ >bignum 10 mod ] build-tree propagate
fourth dup word>> do-inlining
] unit-test
! never-inline-word?
{ t } [
\ + props>> "default-method" of never-inline-word?
] unit-test

View File

@ -0,0 +1,17 @@
USING: compiler.tree.propagation.copy compiler.tree.propagation.info
compiler.tree.propagation.nodes namespaces tools.test ;
IN: compiler.tree.propagation.nodes.tests
{
H{ { 1234 "hello" } }
} [
H{ { 1234 1234 } } copies set
{
H{
{ 1234 "hello" }
{ 4321 "stuff" }
}
} value-infos set
{ 1234 } extract-value-info
] unit-test

View File

@ -1,7 +1,10 @@
USING: tools.test compiler.tree.propagation.recursive
math.intervals kernel math literals layouts ;
USING: accessors tools.test compiler.tree compiler.tree.builder
compiler.tree.optimizer compiler.tree.propagation.info
compiler.tree.propagation.recursive math.intervals kernel kernel.private
math literals layouts sequences ;
IN: compiler.tree.propagation.recursive.tests
! generalize-counter-interval
{ T{ interval f { 0 t } { 1/0. t } } } [
T{ interval f { 1 t } { 1 t } }
T{ interval f { 0 t } { 0 t } }
@ -51,3 +54,20 @@ IN: compiler.tree.propagation.recursive.tests
T{ interval f { 2 t } { 11 t } }
fixnum generalize-counter-interval
] unit-test
! node-output-infos
: integer-loop ( a -- b )
{ integer } declare [ dup 0 > ] [ 1 - ] while ;
{
V{
T{ value-info-state
{ class integer }
{ interval
T{ interval { from { 1 t } } { to { 1/0. t } } }
}
}
}
} [
\ integer-loop build-tree optimize-tree
[ #if? ] filter second children>> first first recursive-phi-infos
] unit-test

View File

@ -0,0 +1,10 @@
USING: accessors compiler.tree kernel tools.test ;
IN: compiler.tree.tests
{
"label"
"a-child"
} [
"label" f "a-child" <#recursive>
[ label>> ] [ child>> ] bi
] unit-test