| 
									
										
										
										
											2009-08-13 17:59:38 -04:00
										 |  |  | ! (c)Joe Groff bsd license | 
					
						
							| 
									
										
										
										
											2011-08-26 00:02:13 -04:00
										 |  |  | USING: accessors alien alien.c-types alien.data alien.syntax | 
					
						
							|  |  |  | ascii assocs byte-arrays classes.struct | 
					
						
							|  |  |  | classes.struct.prettyprint classes.struct.prettyprint.private | 
					
						
							|  |  |  | classes.tuple.parser classes.tuple.private classes.tuple | 
					
						
							|  |  |  | combinators compiler.tree.debugger compiler.units delegate | 
					
						
							|  |  |  | destructors io.encodings.utf8 io.pathnames io.streams.string | 
					
						
							|  |  |  | kernel libc literals math mirrors namespaces prettyprint | 
					
						
							|  |  |  | prettyprint.config see sequences specialized-arrays system | 
					
						
							|  |  |  | tools.test parser lexer eval layouts generic.single classes | 
					
						
							| 
									
										
										
										
											2011-10-24 19:59:46 -04:00
										 |  |  | vocabs generic classes.private definitions ;
 | 
					
						
							| 
									
										
										
										
											2009-09-15 23:43:11 -04:00
										 |  |  | FROM: math => float ;
 | 
					
						
							| 
									
										
										
										
											2010-04-12 21:29:47 -04:00
										 |  |  | FROM: specialized-arrays.private => specialized-array-vocab ;
 | 
					
						
							| 
									
										
										
										
											2009-09-15 22:43:18 -04:00
										 |  |  | QUALIFIED-WITH: alien.c-types c | 
					
						
							| 
									
										
										
										
											2009-09-09 23:33:34 -04:00
										 |  |  | SPECIALIZED-ARRAY: char | 
					
						
							|  |  |  | SPECIALIZED-ARRAY: int | 
					
						
							|  |  |  | SPECIALIZED-ARRAY: ushort | 
					
						
							| 
									
										
										
										
											2009-08-12 10:01:32 -04:00
										 |  |  | IN: classes.struct.tests | 
					
						
							| 
									
										
										
										
											2009-08-11 22:13:18 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-08-26 23:37:59 -04:00
										 |  |  | SYMBOL: struct-test-empty | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | [ [ struct-test-empty { } define-struct-class ] with-compilation-unit ] | 
					
						
							|  |  |  | [ struct-must-have-slots? ] must-fail-with | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-08-20 09:44:19 -04:00
										 |  |  | STRUCT: struct-test-foo | 
					
						
							| 
									
										
										
										
											2009-08-11 22:13:18 -04:00
										 |  |  |     { x char } | 
					
						
							|  |  |  |     { y int initial: 123 } | 
					
						
							| 
									
										
										
										
											2009-08-25 12:40:05 -04:00
										 |  |  |     { z bool } ;
 | 
					
						
							| 
									
										
										
										
											2009-08-11 22:13:18 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-08-20 09:44:19 -04:00
										 |  |  | STRUCT: struct-test-bar | 
					
						
							| 
									
										
										
										
											2011-11-23 21:49:33 -05:00
										 |  |  |     { w ushort initial: 0xffff } | 
					
						
							| 
									
										
										
										
											2009-08-20 09:44:19 -04:00
										 |  |  |     { foo struct-test-foo } ;
 | 
					
						
							| 
									
										
										
										
											2009-08-11 22:13:18 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-08-20 09:44:19 -04:00
										 |  |  | [ 12 ] [ struct-test-foo heap-size ] unit-test | 
					
						
							| 
									
										
										
										
											2009-08-25 20:04:29 -04:00
										 |  |  | [ 12 ] [ struct-test-foo <struct> byte-length ] unit-test | 
					
						
							| 
									
										
										
										
											2009-08-20 09:44:19 -04:00
										 |  |  | [ 16 ] [ struct-test-bar heap-size ] unit-test | 
					
						
							|  |  |  | [ 123 ] [ struct-test-foo <struct> y>> ] unit-test | 
					
						
							|  |  |  | [ 123 ] [ struct-test-bar <struct> foo>> y>> ] unit-test | 
					
						
							| 
									
										
										
										
											2009-08-12 10:01:32 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  | [ 1 2 3 t ] [ | 
					
						
							| 
									
										
										
										
											2009-08-20 09:44:19 -04:00
										 |  |  |     1   2 3 t struct-test-foo <struct-boa>   struct-test-bar <struct-boa> | 
					
						
							| 
									
										
										
										
											2009-08-12 10:01:32 -04:00
										 |  |  |     { | 
					
						
							|  |  |  |         [ w>> ]  | 
					
						
							|  |  |  |         [ foo>> x>> ] | 
					
						
							|  |  |  |         [ foo>> y>> ] | 
					
						
							|  |  |  |         [ foo>> z>> ] | 
					
						
							|  |  |  |     } cleave
 | 
					
						
							|  |  |  | ] unit-test | 
					
						
							| 
									
										
										
										
											2009-08-12 16:04:27 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-08-20 09:44:19 -04:00
										 |  |  | [ 7654 ] [ S{ struct-test-foo f 98 7654 f } y>> ] unit-test | 
					
						
							|  |  |  | [ 7654 ] [ S{ struct-test-foo { y 7654 } } y>> ] unit-test | 
					
						
							| 
									
										
										
										
											2009-08-12 16:09:25 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-08-31 23:26:03 -04:00
										 |  |  | [ { | 
					
						
							|  |  |  |     { "underlying" B{ 98 0 0 98 127 0 0 127 0 0 0 0 } } | 
					
						
							| 
									
										
										
										
											2009-09-15 23:43:11 -04:00
										 |  |  |     { { "x" char } 98            } | 
					
						
							| 
									
										
										
										
											2011-11-23 21:49:33 -05:00
										 |  |  |     { { "y" int  } 0x7F00007F } | 
					
						
							| 
									
										
										
										
											2009-09-15 23:43:11 -04:00
										 |  |  |     { { "z" bool } f             } | 
					
						
							| 
									
										
										
										
											2009-08-31 23:26:03 -04:00
										 |  |  | } ] [ | 
					
						
							|  |  |  |     B{ 98 0 0 98 127 0 0 127 0 0 0 0 } struct-test-foo memory>struct | 
					
						
							|  |  |  |     make-mirror >alist
 | 
					
						
							|  |  |  | ] unit-test | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | [ { { "underlying" f } } ] [ | 
					
						
							|  |  |  |     f struct-test-foo memory>struct | 
					
						
							|  |  |  |     make-mirror >alist
 | 
					
						
							|  |  |  | ] unit-test | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-03-23 17:35:01 -04:00
										 |  |  | [ 55 t ] [ S{ struct-test-foo { x 55 } } make-mirror { "x" "char" } ?of ] unit-test | 
					
						
							|  |  |  | [ 55 t ] [ S{ struct-test-foo { y 55 } } make-mirror { "y" "int"  } ?of ] unit-test | 
					
						
							|  |  |  | [ t  t ] [ S{ struct-test-foo { z t  } } make-mirror { "z" "bool" } ?of ] unit-test | 
					
						
							|  |  |  | [ f  t ] [ S{ struct-test-foo { z f  } } make-mirror { "z" "bool" } ?of ] unit-test | 
					
						
							|  |  |  | [ { "nonexist" "bool" } f ] [ S{ struct-test-foo } make-mirror { "nonexist" "bool" } ?of ] unit-test | 
					
						
							|  |  |  | [ "nonexist" f ] [ S{ struct-test-foo } make-mirror "nonexist" ?of ] unit-test | 
					
						
							|  |  |  | [ f  t ] [ f struct-test-foo memory>struct make-mirror "underlying" ?of ] unit-test | 
					
						
							| 
									
										
										
										
											2009-08-31 23:26:03 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  | [ S{ struct-test-foo { x 3 } { y 2 } { z f } } ] [ | 
					
						
							|  |  |  |     S{ struct-test-foo { x 1 } { y 2 } { z f } } | 
					
						
							|  |  |  |     [ make-mirror [ 3 { "x" "char" } ] dip set-at ] keep
 | 
					
						
							|  |  |  | ] unit-test | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | [ S{ struct-test-foo { x 1 } { y 5 } { z f } } ] [ | 
					
						
							|  |  |  |     S{ struct-test-foo { x 1 } { y 2 } { z f } } | 
					
						
							|  |  |  |     [ make-mirror [ 5 { "y" "int" } ] dip set-at ] keep
 | 
					
						
							|  |  |  | ] unit-test | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | [ S{ struct-test-foo { x 1 } { y 2 } { z t } } ] [ | 
					
						
							|  |  |  |     S{ struct-test-foo { x 1 } { y 2 } { z f } } | 
					
						
							|  |  |  |     [ make-mirror [ t { "z" "bool" } ] dip set-at ] keep
 | 
					
						
							|  |  |  | ] unit-test | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | [ S{ struct-test-foo { x 1 } { y 2 } { z f } } ] [ | 
					
						
							|  |  |  |     S{ struct-test-foo { x 1 } { y 2 } { z f } } | 
					
						
							|  |  |  |     [ make-mirror [ "nonsense" "underlying" ] dip set-at ] keep
 | 
					
						
							|  |  |  | ] unit-test | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | [ S{ struct-test-foo { x 1 } { y 2 } { z f } } ] [ | 
					
						
							|  |  |  |     S{ struct-test-foo { x 1 } { y 2 } { z f } } | 
					
						
							|  |  |  |     [ make-mirror [ "nonsense" "nonexist" ] dip set-at ] keep
 | 
					
						
							|  |  |  | ] unit-test | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | [ S{ struct-test-foo { x 1 } { y 2 } { z f } } ] [ | 
					
						
							|  |  |  |     S{ struct-test-foo { x 1 } { y 2 } { z f } } | 
					
						
							|  |  |  |     [ make-mirror [ "nonsense" { "nonexist" "int" } ] dip set-at ] keep
 | 
					
						
							|  |  |  | ] unit-test | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | [ S{ struct-test-foo { x 1 } { y 123 } { z f } } ] [ | 
					
						
							|  |  |  |     S{ struct-test-foo { x 1 } { y 2 } { z f } } | 
					
						
							|  |  |  |     [ make-mirror { "y" "int" } swap delete-at ] keep
 | 
					
						
							|  |  |  | ] unit-test | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | [ S{ struct-test-foo { x 0 } { y 2 } { z f } } ] [ | 
					
						
							|  |  |  |     S{ struct-test-foo { x 1 } { y 2 } { z f } } | 
					
						
							|  |  |  |     [ make-mirror { "x" "char" } swap delete-at ] keep
 | 
					
						
							|  |  |  | ] unit-test | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | [ S{ struct-test-foo { x 1 } { y 2 } { z f } } ] [ | 
					
						
							|  |  |  |     S{ struct-test-foo { x 1 } { y 2 } { z f } } | 
					
						
							|  |  |  |     [ make-mirror { "nonexist" "char" } swap delete-at ] keep
 | 
					
						
							|  |  |  | ] unit-test | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | [ S{ struct-test-foo { x 1 } { y 2 } { z f } } ] [ | 
					
						
							|  |  |  |     S{ struct-test-foo { x 1 } { y 2 } { z f } } | 
					
						
							|  |  |  |     [ make-mirror "underlying" swap delete-at ] keep
 | 
					
						
							|  |  |  | ] unit-test | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | [ S{ struct-test-foo { x 1 } { y 2 } { z f } } ] [ | 
					
						
							|  |  |  |     S{ struct-test-foo { x 1 } { y 2 } { z f } } | 
					
						
							|  |  |  |     [ make-mirror "nonsense" swap delete-at ] keep
 | 
					
						
							|  |  |  | ] unit-test | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | [ S{ struct-test-foo { x 0 } { y 123 } { z f } } ] [ | 
					
						
							|  |  |  |     S{ struct-test-foo { x 1 } { y 2 } { z t } } | 
					
						
							|  |  |  |     [ make-mirror clear-assoc ] keep
 | 
					
						
							|  |  |  | ] unit-test | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-08-26 00:02:13 -04:00
										 |  |  | [ POSTPONE: STRUCT: ] | 
					
						
							|  |  |  | [ struct-test-foo struct-definer-word ] unit-test | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-08-20 09:44:19 -04:00
										 |  |  | UNION-STRUCT: struct-test-float-and-bits | 
					
						
							| 
									
										
										
										
											2009-09-15 22:43:18 -04:00
										 |  |  |     { f c:float } | 
					
						
							| 
									
										
										
										
											2009-08-13 16:55:22 -04:00
										 |  |  |     { bits uint } ;
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-08-20 09:44:19 -04:00
										 |  |  | [ 1.0 ] [ struct-test-float-and-bits <struct> 1.0 float>bits >>bits f>> ] unit-test | 
					
						
							|  |  |  | [ 4 ] [ struct-test-float-and-bits heap-size ] unit-test | 
					
						
							| 
									
										
										
										
											2009-08-13 16:55:22 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-08-29 23:40:13 -04:00
										 |  |  | [ 123 ] [ [ struct-test-foo malloc-struct &free y>> ] with-destructors ] unit-test | 
					
						
							| 
									
										
										
										
											2009-08-25 14:18:20 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-08-26 00:02:13 -04:00
										 |  |  | [ POSTPONE: UNION-STRUCT: ] | 
					
						
							|  |  |  | [ struct-test-float-and-bits struct-definer-word ] unit-test | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-08-25 14:18:20 -04:00
										 |  |  | STRUCT: struct-test-string-ptr | 
					
						
							| 
									
										
										
										
											2010-02-23 14:42:02 -05:00
										 |  |  |     { x c-string } ;
 | 
					
						
							| 
									
										
										
										
											2009-08-25 14:18:20 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  | [ "hello world" ] [ | 
					
						
							|  |  |  |     [ | 
					
						
							|  |  |  |         struct-test-string-ptr <struct> | 
					
						
							|  |  |  |         "hello world" utf8 malloc-string &free >>x | 
					
						
							|  |  |  |         x>> | 
					
						
							|  |  |  |     ] with-destructors | 
					
						
							|  |  |  | ] unit-test | 
					
						
							| 
									
										
										
										
											2009-08-19 21:21:57 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-08-31 21:46:33 -04:00
										 |  |  | [ "S{ struct-test-foo { x 0 } { y 7654 } { z f } }" ] | 
					
						
							| 
									
										
										
										
											2009-08-20 09:44:19 -04:00
										 |  |  | [ | 
					
						
							| 
									
										
										
										
											2012-07-19 16:55:34 -04:00
										 |  |  |     H{ { boa-tuples? f } { c-object-pointers? f } } [ | 
					
						
							| 
									
										
										
										
											2009-08-30 21:46:31 -04:00
										 |  |  |         struct-test-foo <struct> 7654 >>y [ pprint ] with-string-writer | 
					
						
							| 
									
										
										
										
											2012-07-19 16:55:34 -04:00
										 |  |  |     ] with-variables
 | 
					
						
							| 
									
										
										
										
											2009-08-30 21:46:31 -04:00
										 |  |  | ] unit-test | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | [ "S@ struct-test-foo B{ 0 0 0 0 0 0 0 0 0 0 0 0 }" ] | 
					
						
							|  |  |  | [ | 
					
						
							| 
									
										
										
										
											2012-07-19 16:55:34 -04:00
										 |  |  |     H{ { c-object-pointers? t } } [ | 
					
						
							| 
									
										
										
										
											2009-08-30 21:46:31 -04:00
										 |  |  |         12 <byte-array> struct-test-foo memory>struct [ pprint ] with-string-writer | 
					
						
							| 
									
										
										
										
											2012-07-19 16:55:34 -04:00
										 |  |  |     ] with-variables
 | 
					
						
							| 
									
										
										
										
											2009-08-20 09:44:19 -04:00
										 |  |  | ] unit-test | 
					
						
							| 
									
										
										
										
											2009-08-19 21:21:57 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-08-20 09:44:19 -04:00
										 |  |  | [ "S{ struct-test-foo f 0 7654 f }" ] | 
					
						
							|  |  |  | [ | 
					
						
							| 
									
										
										
										
											2012-07-19 16:55:34 -04:00
										 |  |  |     H{ { boa-tuples? t } { c-object-pointers? f } } [ | 
					
						
							| 
									
										
										
										
											2009-08-30 21:46:31 -04:00
										 |  |  |         struct-test-foo <struct> 7654 >>y [ pprint ] with-string-writer | 
					
						
							| 
									
										
										
										
											2012-07-19 16:55:34 -04:00
										 |  |  |     ] with-variables
 | 
					
						
							| 
									
										
										
										
											2009-08-30 21:46:31 -04:00
										 |  |  | ] unit-test | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | [ "S@ struct-test-foo f" ] | 
					
						
							|  |  |  | [ | 
					
						
							| 
									
										
										
										
											2012-07-19 16:55:34 -04:00
										 |  |  |     H{ { c-object-pointers? f } } [ | 
					
						
							| 
									
										
										
										
											2009-08-30 21:46:31 -04:00
										 |  |  |         f struct-test-foo memory>struct [ pprint ] with-string-writer | 
					
						
							| 
									
										
										
										
											2012-07-19 16:55:34 -04:00
										 |  |  |     ] with-variables
 | 
					
						
							| 
									
										
										
										
											2009-08-20 09:44:19 -04:00
										 |  |  | ] unit-test | 
					
						
							| 
									
										
										
										
											2009-08-19 21:21:57 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-09-21 00:02:49 -04:00
										 |  |  | [ "USING: alien.c-types classes.struct ;
 | 
					
						
							| 
									
										
										
										
											2009-08-19 21:32:49 -04:00
										 |  |  | IN: classes.struct.tests | 
					
						
							| 
									
										
										
										
											2009-08-20 09:44:19 -04:00
										 |  |  | STRUCT: struct-test-foo | 
					
						
							| 
									
										
										
										
											2009-08-25 14:03:43 -04:00
										 |  |  |     { x char initial: 0 } { y int initial: 123 } { z bool } ;
 | 
					
						
							| 
									
										
										
										
											2009-09-20 23:42:40 -04:00
										 |  |  | " ] | 
					
						
							| 
									
										
										
										
											2009-08-20 09:44:19 -04:00
										 |  |  | [ [ struct-test-foo see ] with-string-writer ] unit-test | 
					
						
							| 
									
										
										
										
											2009-08-19 21:32:49 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-09-21 00:02:49 -04:00
										 |  |  | [ "USING: alien.c-types classes.struct ;
 | 
					
						
							| 
									
										
										
										
											2009-08-19 21:32:49 -04:00
										 |  |  | IN: classes.struct.tests | 
					
						
							| 
									
										
										
										
											2009-08-20 09:44:19 -04:00
										 |  |  | UNION-STRUCT: struct-test-float-and-bits | 
					
						
							| 
									
										
										
										
											2009-08-25 12:40:05 -04:00
										 |  |  |     { f float initial: 0.0 } { bits uint initial: 0 } ;
 | 
					
						
							| 
									
										
										
										
											2009-09-20 23:42:40 -04:00
										 |  |  | " ] | 
					
						
							| 
									
										
										
										
											2009-08-20 09:44:19 -04:00
										 |  |  | [ [ struct-test-float-and-bits see ] with-string-writer ] unit-test | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | [ { | 
					
						
							| 
									
										
										
										
											2009-09-15 18:38:49 -04:00
										 |  |  |     T{ struct-slot-spec | 
					
						
							| 
									
										
										
										
											2009-08-20 09:44:19 -04:00
										 |  |  |         { name "x" } | 
					
						
							|  |  |  |         { offset 0 } | 
					
						
							| 
									
										
										
										
											2009-09-15 20:10:05 -04:00
										 |  |  |         { initial 0 } | 
					
						
							| 
									
										
										
										
											2009-09-15 18:38:49 -04:00
										 |  |  |         { class fixnum } | 
					
						
							| 
									
										
										
										
											2009-09-15 22:43:18 -04:00
										 |  |  |         { type char } | 
					
						
							| 
									
										
										
										
											2009-08-20 09:44:19 -04:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2009-09-15 18:38:49 -04:00
										 |  |  |     T{ struct-slot-spec | 
					
						
							| 
									
										
										
										
											2009-08-20 09:44:19 -04:00
										 |  |  |         { name "y" } | 
					
						
							|  |  |  |         { offset 4 } | 
					
						
							| 
									
										
										
										
											2009-09-15 20:10:05 -04:00
										 |  |  |         { initial 123 } | 
					
						
							| 
									
										
										
										
											2010-05-04 19:33:46 -04:00
										 |  |  |         { class $[ cell 4 = integer fixnum ? ] } | 
					
						
							| 
									
										
										
										
											2009-09-15 22:43:18 -04:00
										 |  |  |         { type int } | 
					
						
							| 
									
										
										
										
											2009-08-20 09:44:19 -04:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2009-09-15 18:38:49 -04:00
										 |  |  |     T{ struct-slot-spec | 
					
						
							| 
									
										
										
										
											2009-08-20 09:44:19 -04:00
										 |  |  |         { name "z" } | 
					
						
							|  |  |  |         { offset 8 } | 
					
						
							| 
									
										
										
										
											2009-09-15 20:10:05 -04:00
										 |  |  |         { initial f } | 
					
						
							| 
									
										
										
										
											2009-09-15 22:43:18 -04:00
										 |  |  |         { type bool } | 
					
						
							| 
									
										
										
										
											2009-09-15 20:10:05 -04:00
										 |  |  |         { class object } | 
					
						
							| 
									
										
										
										
											2009-08-20 09:44:19 -04:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2011-10-24 17:31:10 -04:00
										 |  |  | } ] [ struct-test-foo lookup-c-type fields>> ] unit-test | 
					
						
							| 
									
										
										
										
											2009-08-20 09:44:19 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  | [ { | 
					
						
							| 
									
										
										
										
											2009-09-15 18:38:49 -04:00
										 |  |  |     T{ struct-slot-spec | 
					
						
							| 
									
										
										
										
											2009-08-20 09:44:19 -04:00
										 |  |  |         { name "f" } | 
					
						
							|  |  |  |         { offset 0 } | 
					
						
							| 
									
										
										
										
											2009-09-15 22:43:18 -04:00
										 |  |  |         { type c:float } | 
					
						
							| 
									
										
										
										
											2009-09-15 18:38:49 -04:00
										 |  |  |         { class float } | 
					
						
							| 
									
										
										
										
											2009-09-15 20:10:05 -04:00
										 |  |  |         { initial 0.0 } | 
					
						
							| 
									
										
										
										
											2009-08-20 09:44:19 -04:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2009-09-15 18:38:49 -04:00
										 |  |  |     T{ struct-slot-spec | 
					
						
							| 
									
										
										
										
											2009-08-20 09:44:19 -04:00
										 |  |  |         { name "bits" } | 
					
						
							|  |  |  |         { offset 0 } | 
					
						
							| 
									
										
										
										
											2009-09-15 22:43:18 -04:00
										 |  |  |         { type uint } | 
					
						
							| 
									
										
										
										
											2010-05-04 19:33:46 -04:00
										 |  |  |         { class $[ cell 4 = integer fixnum ? ] } | 
					
						
							| 
									
										
										
										
											2009-09-15 20:10:05 -04:00
										 |  |  |         { initial 0 } | 
					
						
							| 
									
										
										
										
											2009-08-20 09:44:19 -04:00
										 |  |  |     } | 
					
						
							| 
									
										
										
										
											2011-10-24 17:31:10 -04:00
										 |  |  | } ] [ struct-test-float-and-bits lookup-c-type fields>> ] unit-test | 
					
						
							| 
									
										
										
										
											2009-08-20 09:44:19 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-08-26 19:05:38 -04:00
										 |  |  | STRUCT: struct-test-equality-1 | 
					
						
							|  |  |  |     { x int } ;
 | 
					
						
							|  |  |  | STRUCT: struct-test-equality-2 | 
					
						
							|  |  |  |     { y int } ;
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-08-06 03:15:22 -04:00
										 |  |  | [ 0 ] [ struct-test-equality-1 new hashcode ] unit-test | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-08-26 19:05:38 -04:00
										 |  |  | [ t ] [ | 
					
						
							|  |  |  |     [ | 
					
						
							|  |  |  |         struct-test-equality-1 <struct> 5 >>x | 
					
						
							|  |  |  |         struct-test-equality-1 malloc-struct &free 5 >>x =
 | 
					
						
							|  |  |  |     ] with-destructors | 
					
						
							|  |  |  | ] unit-test | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | [ f ] [ | 
					
						
							|  |  |  |     [ | 
					
						
							|  |  |  |         struct-test-equality-1 <struct> 5 >>x | 
					
						
							|  |  |  |         struct-test-equality-2 malloc-struct &free 5 >>y =
 | 
					
						
							|  |  |  |     ] with-destructors | 
					
						
							|  |  |  | ] unit-test | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-08-31 11:51:45 -04:00
										 |  |  | [ t ] [ | 
					
						
							|  |  |  |     [ | 
					
						
							|  |  |  |         struct-test-equality-1 <struct> 5 >>x | 
					
						
							|  |  |  |         struct-test-equality-1 malloc-struct &free 5 >>x | 
					
						
							| 
									
										
										
										
											2012-07-21 13:22:44 -04:00
										 |  |  |         [ hashcode ] same?
 | 
					
						
							| 
									
										
										
										
											2009-08-31 11:51:45 -04:00
										 |  |  |     ] with-destructors | 
					
						
							|  |  |  | ] unit-test | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-08-25 22:54:19 -04:00
										 |  |  | STRUCT: struct-test-array-slots | 
					
						
							|  |  |  |     { x int } | 
					
						
							|  |  |  |     { y ushort[6] initial: ushort-array{ 2 3 5 7 11 13 } } | 
					
						
							|  |  |  |     { z int } ;
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | [ 11 ] [ struct-test-array-slots <struct> y>> 4 swap nth ] unit-test | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | [ t ] [ | 
					
						
							|  |  |  |     struct-test-array-slots <struct> | 
					
						
							|  |  |  |     [ y>> [ 8 3 ] dip set-nth ] | 
					
						
							|  |  |  |     [ y>> ushort-array{ 2 3 5 8 11 13 } sequence= ] bi
 | 
					
						
							|  |  |  | ] unit-test | 
					
						
							| 
									
										
										
										
											2009-08-26 22:38:00 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  | STRUCT: struct-test-optimization | 
					
						
							| 
									
										
										
										
											2009-09-15 22:43:18 -04:00
										 |  |  |     { x { int 3 } } { y int } ;
 | 
					
						
							| 
									
										
										
										
											2009-08-26 22:38:00 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-09-09 23:33:34 -04:00
										 |  |  | SPECIALIZED-ARRAY: struct-test-optimization | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-08-26 22:38:00 -04:00
										 |  |  | [ t ] [ [ struct-test-optimization memory>struct y>> ] { memory>struct y>> } inlined? ] unit-test | 
					
						
							|  |  |  | [ t ] [ | 
					
						
							| 
									
										
										
										
											2011-10-15 22:19:44 -04:00
										 |  |  |     [ 3 struct-test-optimization <c-direct-array> third y>> ] | 
					
						
							| 
									
										
										
										
											2009-08-26 22:38:00 -04:00
										 |  |  |     { <tuple> <tuple-boa> memory>struct y>> } inlined? | 
					
						
							|  |  |  | ] unit-test | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-08-26 22:50:12 -04:00
										 |  |  | [ t ] [ [ struct-test-optimization memory>struct y>> ] { memory>struct y>> } inlined? ] unit-test | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | [ t ] [ | 
					
						
							|  |  |  |     [ struct-test-optimization memory>struct x>> second ] | 
					
						
							| 
									
										
										
										
											2011-09-25 14:49:27 -04:00
										 |  |  |     { memory>struct x>> int <c-direct-array> <tuple> <tuple-boa> } inlined? | 
					
						
							| 
									
										
										
										
											2009-08-26 22:50:12 -04:00
										 |  |  | ] unit-test | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-08-26 22:38:00 -04:00
										 |  |  | [ f ] [ [ memory>struct y>> ] { memory>struct y>> } inlined? ] unit-test | 
					
						
							| 
									
										
										
										
											2009-08-29 23:54:56 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-09-07 18:45:03 -04:00
										 |  |  | [ t ] [ | 
					
						
							|  |  |  |     [ struct-test-optimization <struct> struct-test-optimization <struct> [ x>> ] bi@ ] | 
					
						
							|  |  |  |     { x>> } inlined? | 
					
						
							|  |  |  | ] unit-test | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-04-12 21:29:47 -04:00
										 |  |  | [ ] [ | 
					
						
							|  |  |  |     [ | 
					
						
							|  |  |  |         struct-test-optimization specialized-array-vocab forget-vocab | 
					
						
							|  |  |  |     ] with-compilation-unit | 
					
						
							|  |  |  | ] unit-test | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-08-30 22:01:44 -04:00
										 |  |  | ! Test cloning structs | 
					
						
							|  |  |  | STRUCT: clone-test-struct { x int } { y char[3] } ;
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | [ 1 char-array{ 9 1 1 } ] [ | 
					
						
							|  |  |  |     clone-test-struct <struct> | 
					
						
							|  |  |  |     1 >>x char-array{ 9 1 1 } >>y | 
					
						
							|  |  |  |     clone
 | 
					
						
							| 
									
										
										
										
											2011-09-25 14:49:27 -04:00
										 |  |  |     [ x>> ] [ y>> char >c-array ] bi
 | 
					
						
							| 
									
										
										
										
											2009-08-30 22:01:44 -04:00
										 |  |  | ] unit-test | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | [ t 1 char-array{ 9 1 1 } ] [ | 
					
						
							|  |  |  |     [ | 
					
						
							|  |  |  |         clone-test-struct malloc-struct &free | 
					
						
							|  |  |  |         1 >>x char-array{ 9 1 1 } >>y | 
					
						
							|  |  |  |         clone
 | 
					
						
							| 
									
										
										
										
											2011-09-25 14:49:27 -04:00
										 |  |  |         [ >c-ptr byte-array? ] [ x>> ] [ y>> char >c-array ] tri
 | 
					
						
							| 
									
										
										
										
											2009-08-30 22:01:44 -04:00
										 |  |  |     ] with-destructors | 
					
						
							|  |  |  | ] unit-test | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | STRUCT: struct-that's-a-word { x int } ;
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | : struct-that's-a-word ( -- ) "OOPS" throw ;
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | [ -77 ] [ S{ struct-that's-a-word { x -77 } } clone x>> ] unit-test | 
					
						
							| 
									
										
										
										
											2009-09-07 18:45:03 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-09-10 16:59:27 -04:00
										 |  |  | ! Interactive parsing of struct slot definitions | 
					
						
							|  |  |  | [ | 
					
						
							|  |  |  |     "USE: classes.struct IN: classes.struct.tests STRUCT: unexpected-eof-test" <string-reader> | 
					
						
							|  |  |  |     "struct-class-test-1" parse-stream | 
					
						
							|  |  |  | ] [ error>> error>> unexpected-eof? ] must-fail-with | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-02-25 14:52:21 -05:00
										 |  |  | [ | 
					
						
							|  |  |  |     "USING: alien.c-types classes.struct ; IN: classes.struct.tests STRUCT: struct-test-duplicate-slots { x uint } { x uint } ;" eval( -- ) | 
					
						
							|  |  |  | ] [ error>> duplicate-slot-names? ] must-fail-with | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | [ | 
					
						
							|  |  |  |     "USING: alien.c-types classes.struct ; IN: classes.struct.tests STRUCT: struct-test-duplicate-slots { x uint } { x float } ;" eval( -- ) | 
					
						
							|  |  |  | ] [ error>> duplicate-slot-names? ] must-fail-with | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-09-10 16:59:27 -04:00
										 |  |  | ! S{ with non-struct type | 
					
						
							|  |  |  | [ | 
					
						
							|  |  |  |     "USE: classes.struct IN: classes.struct.tests TUPLE: not-a-struct ; S{ not-a-struct }" | 
					
						
							|  |  |  |     eval( -- value ) | 
					
						
							| 
									
										
										
										
											2010-02-17 08:19:57 -05:00
										 |  |  | ] [ error>> no-method? ] must-fail-with | 
					
						
							| 
									
										
										
										
											2009-09-10 16:59:27 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  | ! Subclassing a struct class should not be allowed | 
					
						
							|  |  |  | [ | 
					
						
							| 
									
										
										
										
											2010-02-17 08:19:57 -05:00
										 |  |  |     "USING: alien.c-types classes.struct ; IN: classes.struct.tests STRUCT: a-struct { x int } ; TUPLE: not-a-struct < a-struct ;" | 
					
						
							| 
									
										
										
										
											2009-09-10 16:59:27 -04:00
										 |  |  |     eval( -- ) | 
					
						
							| 
									
										
										
										
											2010-02-17 08:19:57 -05:00
										 |  |  | ] [ error>> bad-superclass? ] must-fail-with | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | ! Changing a superclass into a struct should reset the subclass | 
					
						
							|  |  |  | TUPLE: will-become-struct ;
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | TUPLE: a-subclass < will-become-struct ;
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | [ f ] [ will-become-struct struct-class? ] unit-test | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | [ will-become-struct ] [ a-subclass superclass ] unit-test | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | [ ] [ "IN: classes.struct.tests USING: classes.struct alien.c-types ; STRUCT: will-become-struct { x int } ;" eval( -- ) ] unit-test | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | [ t ] [ will-become-struct struct-class? ] unit-test | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | [ tuple ] [ a-subclass superclass ] unit-test | 
					
						
							| 
									
										
										
										
											2009-09-10 16:59:27 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-10-07 02:43:32 -04:00
										 |  |  | STRUCT: bit-field-test | 
					
						
							|  |  |  |     { a uint bits: 12 } | 
					
						
							|  |  |  |     { b int bits: 2 } | 
					
						
							|  |  |  |     { c char } ;
 | 
					
						
							| 
									
										
										
										
											2009-10-07 22:35:12 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  | [ S{ bit-field-test f 0 0 0 } ] [ bit-field-test <struct> ] unit-test | 
					
						
							|  |  |  | [ S{ bit-field-test f 1 -2 3 } ] [ bit-field-test <struct> 1 >>a 2 >>b 3 >>c ] unit-test | 
					
						
							|  |  |  | [ 4095 ] [ bit-field-test <struct> 8191 >>a a>> ] unit-test | 
					
						
							|  |  |  | [ 1 ] [ bit-field-test <struct> 1 >>b b>> ] unit-test | 
					
						
							|  |  |  | [ -2 ] [ bit-field-test <struct> 2 >>b b>> ] unit-test | 
					
						
							|  |  |  | [ 1 ] [ bit-field-test <struct> 257 >>c c>> ] unit-test | 
					
						
							|  |  |  | [ 3 ] [ bit-field-test heap-size ] unit-test | 
					
						
							| 
									
										
										
										
											2009-11-10 20:34:14 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-02-21 19:27:36 -05:00
										 |  |  | STRUCT: referent | 
					
						
							|  |  |  |     { y int } ;
 | 
					
						
							|  |  |  | STRUCT: referrer | 
					
						
							|  |  |  |     { x referent* } ;
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | [ 57 ] [ | 
					
						
							|  |  |  |     [ | 
					
						
							|  |  |  |         referrer <struct> | 
					
						
							|  |  |  |             referent malloc-struct &free | 
					
						
							|  |  |  |                 57 >>y | 
					
						
							|  |  |  |             >>x | 
					
						
							|  |  |  |         x>> y>> | 
					
						
							|  |  |  |     ] with-destructors | 
					
						
							|  |  |  | ] unit-test | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | STRUCT: self-referent | 
					
						
							|  |  |  |     { x self-referent* } | 
					
						
							|  |  |  |     { y int } ;
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | [ 75 ] [ | 
					
						
							|  |  |  |     [ | 
					
						
							|  |  |  |         self-referent <struct> | 
					
						
							|  |  |  |             self-referent malloc-struct &free | 
					
						
							|  |  |  |                 75 >>y | 
					
						
							|  |  |  |             >>x | 
					
						
							|  |  |  |         x>> y>> | 
					
						
							|  |  |  |     ] with-destructors | 
					
						
							|  |  |  | ] unit-test | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | C-TYPE: forward-referent | 
					
						
							|  |  |  | STRUCT: backward-referent | 
					
						
							|  |  |  |     { x forward-referent* } | 
					
						
							|  |  |  |     { y int } ;
 | 
					
						
							|  |  |  | STRUCT: forward-referent | 
					
						
							|  |  |  |     { x backward-referent* } | 
					
						
							|  |  |  |     { y int } ;
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | [ 41 ] [ | 
					
						
							|  |  |  |     [ | 
					
						
							|  |  |  |         forward-referent <struct> | 
					
						
							|  |  |  |             backward-referent malloc-struct &free | 
					
						
							|  |  |  |                 41 >>y | 
					
						
							|  |  |  |             >>x | 
					
						
							|  |  |  |         x>> y>> | 
					
						
							|  |  |  |     ] with-destructors | 
					
						
							|  |  |  | ] unit-test | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | [ 14 ] [ | 
					
						
							|  |  |  |     [ | 
					
						
							|  |  |  |         backward-referent <struct> | 
					
						
							|  |  |  |             forward-referent malloc-struct &free | 
					
						
							|  |  |  |                 14 >>y | 
					
						
							|  |  |  |             >>x | 
					
						
							|  |  |  |         x>> y>> | 
					
						
							|  |  |  |     ] with-destructors | 
					
						
							|  |  |  | ] unit-test | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-11-10 20:34:14 -05:00
										 |  |  | cpu ppc? [ | 
					
						
							|  |  |  |     STRUCT: ppc-align-test-1 | 
					
						
							|  |  |  |         { x longlong } | 
					
						
							|  |  |  |         { y int } ;
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     [ 16 ] [ ppc-align-test-1 heap-size ] unit-test | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     STRUCT: ppc-align-test-2 | 
					
						
							|  |  |  |         { y int } | 
					
						
							|  |  |  |         { x longlong } ;
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-11-02 21:40:27 -04:00
										 |  |  |     [ 16 ] [ ppc-align-test-2 heap-size ] unit-test | 
					
						
							|  |  |  |     [ 8 ] [ "x" ppc-align-test-2 offset-of ] unit-test | 
					
						
							| 
									
										
										
										
											2009-11-10 20:34:14 -05:00
										 |  |  | ] when
 | 
					
						
							| 
									
										
										
										
											2010-06-08 15:52:46 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  | STRUCT: struct-test-delegate | 
					
						
							|  |  |  |     { a int } ;
 | 
					
						
							|  |  |  | STRUCT: struct-test-delegator | 
					
						
							|  |  |  |     { del struct-test-delegate } | 
					
						
							|  |  |  |     { b int } ;
 | 
					
						
							|  |  |  | CONSULT: struct-test-delegate struct-test-delegator del>> ;
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | [ S{ struct-test-delegator f S{ struct-test-delegate f 7 } 8 } ] [ | 
					
						
							|  |  |  |     struct-test-delegator <struct> | 
					
						
							|  |  |  |         7 >>a | 
					
						
							|  |  |  |         8 >>b | 
					
						
							|  |  |  | ] unit-test | 
					
						
							| 
									
										
										
										
											2010-08-15 05:44:21 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  | SPECIALIZED-ARRAY: void* | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | STRUCT: silly-array-field-test { x int*[3] } ;
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | [ t ] [ silly-array-field-test <struct> x>> void*-array? ] unit-test | 
					
						
							| 
									
										
										
										
											2011-08-26 00:02:13 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  | ! Packed structs | 
					
						
							|  |  |  | PACKED-STRUCT: packed-struct-test | 
					
						
							|  |  |  |     { d c:int } | 
					
						
							|  |  |  |     { e c:short } | 
					
						
							|  |  |  |     { f c:int } | 
					
						
							|  |  |  |     { g c:char } | 
					
						
							|  |  |  |     { h c:int } ;
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | [ 15 ] [ packed-struct-test heap-size ] unit-test | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | [ 0 ] [ "d" packed-struct-test offset-of ] unit-test | 
					
						
							|  |  |  | [ 4 ] [ "e" packed-struct-test offset-of ] unit-test | 
					
						
							|  |  |  | [ 6 ] [ "f" packed-struct-test offset-of ] unit-test | 
					
						
							|  |  |  | [ 10 ] [ "g" packed-struct-test offset-of ] unit-test | 
					
						
							|  |  |  | [ 11 ] [ "h" packed-struct-test offset-of ] unit-test | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | [ POSTPONE: PACKED-STRUCT: ] | 
					
						
							|  |  |  | [ packed-struct-test struct-definer-word ] unit-test | 
					
						
							| 
									
										
										
										
											2011-09-25 20:25:28 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  | STRUCT: struct-1 { a c:int } ;
 | 
					
						
							|  |  |  | PACKED-STRUCT: struct-1-packed { a c:int } ;
 | 
					
						
							|  |  |  | UNION-STRUCT: struct-1-union { a c:int } ;
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | [ "USING: alien.c-types classes.struct ;
 | 
					
						
							|  |  |  | IN: classes.struct.tests | 
					
						
							|  |  |  | STRUCT: struct-1 { a int initial: 0 } ;
 | 
					
						
							|  |  |  | " ] | 
					
						
							|  |  |  | [ \ struct-1 [ see ] with-string-writer ] unit-test | 
					
						
							|  |  |  | [ "USING: alien.c-types classes.struct ;
 | 
					
						
							|  |  |  | IN: classes.struct.tests | 
					
						
							|  |  |  | PACKED-STRUCT: struct-1-packed { a int initial: 0 } ;
 | 
					
						
							|  |  |  | " ] | 
					
						
							|  |  |  | [ \ struct-1-packed [ see ] with-string-writer ] unit-test | 
					
						
							|  |  |  | [ "USING: alien.c-types classes.struct ;
 | 
					
						
							|  |  |  | IN: classes.struct.tests | 
					
						
							|  |  |  | STRUCT: struct-1-union { a int initial: 0 } ;
 | 
					
						
							|  |  |  | " ] | 
					
						
							|  |  |  | [ \ struct-1-union [ see ] with-string-writer ] unit-test | 
					
						
							| 
									
										
										
										
											2011-10-02 23:06:44 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  | ! Bug #206 | 
					
						
							| 
									
										
										
										
											2011-10-03 16:54:34 -04:00
										 |  |  | STRUCT: going-to-redefine { a uint } ;
 | 
					
						
							| 
									
										
										
										
											2011-10-02 23:06:44 -04:00
										 |  |  | [ ] [ | 
					
						
							| 
									
										
										
										
											2011-10-03 16:54:34 -04:00
										 |  |  |     "IN: classes.struct.tests TUPLE: going-to-redefine b ;" eval( -- ) | 
					
						
							| 
									
										
										
										
											2011-10-02 23:06:44 -04:00
										 |  |  | ] unit-test | 
					
						
							| 
									
										
										
										
											2011-10-03 18:49:49 -04:00
										 |  |  | [ f ] [ \ going-to-redefine \ clone ?lookup-method ] unit-test | 
					
						
							|  |  |  | [ f ] [ \ going-to-redefine \ struct-slot-values ?lookup-method ] unit-test | 
					
						
							| 
									
										
										
										
											2011-10-02 23:06:44 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-10-04 13:40:48 -04:00
										 |  |  | ! Test reset-class on structs, which should forget all the accessors, clone, and struct-slot-values | 
					
						
							|  |  |  | STRUCT: some-accessors { aaa uint } { bbb int } ;
 | 
					
						
							|  |  |  | [ ] [ [ \ some-accessors reset-class ] with-compilation-unit ] unit-test | 
					
						
							|  |  |  | [ f ] [ \ some-accessors \ a>> ?lookup-method ] unit-test | 
					
						
							|  |  |  | [ f ] [ \ some-accessors \ a<< ?lookup-method ] unit-test | 
					
						
							|  |  |  | [ f ] [ \ some-accessors \ b>> ?lookup-method ] unit-test | 
					
						
							|  |  |  | [ f ] [ \ some-accessors \ b<< ?lookup-method ] unit-test | 
					
						
							|  |  |  | [ f ] [ \ some-accessors \ clone ?lookup-method ] unit-test | 
					
						
							|  |  |  | [ f ] [ \ some-accessors \ struct-slot-values ?lookup-method ] unit-test | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-10-24 19:59:46 -04:00
										 |  |  | << \ some-accessors forget >> |