]> gitweb.factorcode.org Git - factor.git/commitdiff
test that struct-arrays and struct construction optimize down
authorJoe Groff <arcata@gmail.com>
Thu, 27 Aug 2009 02:38:00 +0000 (21:38 -0500)
committerJoe Groff <arcata@gmail.com>
Thu, 27 Aug 2009 02:38:00 +0000 (21:38 -0500)
basis/classes/struct/struct-tests.factor

index d788b9bdb1d801fbb792911eba9c77d3a2c77491..cc781225e6cd37aedeafc84e3dd5375003196c2c 100644 (file)
@@ -4,7 +4,8 @@ alien.structs.fields alien.syntax ascii classes.struct combinators
 destructors io.encodings.utf8 io.pathnames io.streams.string
 kernel libc literals math multiline namespaces prettyprint
 prettyprint.config see sequences specialized-arrays.ushort
-system tools.test combinators.short-circuit ;
+system tools.test compiler.tree.debugger struct-arrays
+classes.tuple.private ;
 IN: classes.struct.tests
 
 <<
@@ -178,3 +179,14 @@ STRUCT: struct-test-array-slots
     [ y>> [ 8 3 ] dip set-nth ]
     [ y>> ushort-array{ 2 3 5 8 11 13 } sequence= ] bi
 ] unit-test
+
+STRUCT: struct-test-optimization
+    { x int } { y int } ;
+
+[ t ] [ [ struct-test-optimization memory>struct y>> ] { memory>struct y>> } inlined? ] unit-test
+[ t ] [
+    [ 3 struct-test-optimization <direct-struct-array> third y>> ]
+    { <tuple> <tuple-boa> memory>struct y>> } inlined?
+] unit-test
+
+[ f ] [ [ memory>struct y>> ] { memory>struct y>> } inlined? ] unit-test