| 
									
										
										
										
											2016-03-30 21:43:14 -04:00
										 |  |  | USING: arrays continuations io.streams.null kernel | 
					
						
							|  |  |  | kernel.private literals make math math.order memory namespaces | 
					
						
							|  |  |  | prettyprint sbufs sequences strings strings.private tools.test | 
					
						
							|  |  |  | vectors ;
 | 
					
						
							| 
									
										
										
										
											2007-09-20 18:09:08 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-02 20:28:17 -04:00
										 |  |  | { CHAR: b } [ 1 >bignum "abc" nth ] unit-test | 
					
						
							| 
									
										
										
										
											2007-09-20 18:09:08 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-02 20:28:17 -04:00
										 |  |  | { } [ 10 [ [ -1000000 <sbuf> ] ignore-errors ] times ] unit-test | 
					
						
							| 
									
										
										
										
											2007-09-20 18:09:08 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-02 20:28:17 -04:00
										 |  |  | { "abc" } [ [ "a" "b" "c" ] [ [ % ] each ] "" make ] unit-test | 
					
						
							| 
									
										
										
										
											2007-09-20 18:09:08 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-02 20:28:17 -04:00
										 |  |  | { "abc" } [ "ab" "c" append ] unit-test | 
					
						
							|  |  |  | { "abc" } [ "a" "b" "c" 3append ] unit-test | 
					
						
							| 
									
										
										
										
											2007-09-20 18:09:08 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-06-01 15:45:54 -04:00
										 |  |  | { 3 } [ "a" "hola" subseq-start ] unit-test | 
					
						
							|  |  |  | { f } [ "x" "hola" subseq-start ] unit-test | 
					
						
							|  |  |  | { 0 } [ "" "a" subseq-start ] unit-test | 
					
						
							|  |  |  | { 0 } [ "" "" subseq-start ] unit-test | 
					
						
							|  |  |  | { 0 } [ "hola" "hola" subseq-start ] unit-test | 
					
						
							|  |  |  | { 1 } [ "ol" "hola" subseq-start ] unit-test | 
					
						
							|  |  |  | { f } [ "amigo" "hola" subseq-start ] unit-test | 
					
						
							|  |  |  | { f } [ "holaa" "hola" subseq-start ] unit-test | 
					
						
							| 
									
										
										
										
											2007-09-20 18:09:08 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-02 20:28:17 -04:00
										 |  |  | { "Beginning" } [ "Beginning and end" 9 head ] unit-test | 
					
						
							| 
									
										
										
										
											2007-09-20 18:09:08 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-02 20:28:17 -04:00
										 |  |  | { f } [ CHAR: I "team" member? ] unit-test | 
					
						
							| 
									
										
										
										
											2017-01-21 10:20:14 -05:00
										 |  |  | { t } [ "ea" "team" subseq? ] unit-test | 
					
						
							|  |  |  | { f } [ "actore" "Factor" subseq? ] unit-test | 
					
						
							| 
									
										
										
										
											2007-09-20 18:09:08 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-02 20:28:17 -04:00
										 |  |  | { "end" } [ "Beginning and end" 14 tail ] unit-test | 
					
						
							| 
									
										
										
										
											2007-09-20 18:09:08 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-02 20:28:17 -04:00
										 |  |  | { t } [ "abc" "abd" before? ] unit-test | 
					
						
							|  |  |  | { t } [ "z" "abd" after? ] unit-test | 
					
						
							|  |  |  | { "abc" } [ "abc" "abd" min ] unit-test | 
					
						
							|  |  |  | { "z" } [ "z" "abd" max ] unit-test | 
					
						
							| 
									
										
										
										
											2007-09-20 18:09:08 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-02-06 14:47:19 -05:00
										 |  |  | [ 0 10 "hello" subseq ] must-fail | 
					
						
							| 
									
										
										
										
											2007-09-20 18:09:08 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-02 20:28:17 -04:00
										 |  |  | { "Replacing+spaces+with+plus" } | 
					
						
							| 
									
										
										
										
											2007-09-20 18:09:08 -04:00
										 |  |  | [ | 
					
						
							|  |  |  |     "Replacing spaces with plus" | 
					
						
							|  |  |  |     [ dup CHAR: \s = [ drop CHAR: + ] when ] map
 | 
					
						
							|  |  |  | ] | 
					
						
							|  |  |  | unit-test | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-02 20:28:17 -04:00
										 |  |  | { "05" } [ "5" 2 CHAR: 0 pad-head ] unit-test | 
					
						
							|  |  |  | { "666" } [ "666" 2 CHAR: 0 pad-head ] unit-test | 
					
						
							| 
									
										
										
										
											2007-09-20 18:09:08 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-02-06 14:47:19 -05:00
										 |  |  | [ 1 "" nth ] must-fail | 
					
						
							|  |  |  | [ -6 "hello" nth ] must-fail | 
					
						
							| 
									
										
										
										
											2007-09-20 18:09:08 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-02 20:28:17 -04:00
										 |  |  | { t } [ "hello world" dup >vector >string = ] unit-test | 
					
						
							| 
									
										
										
										
											2007-09-20 18:09:08 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-02 20:28:17 -04:00
										 |  |  | { "ab" } [ 2 "abc" resize-string ] unit-test | 
					
						
							|  |  |  | { "abc\0\0\0" } [ 6 "abc" resize-string ] unit-test | 
					
						
							| 
									
										
										
										
											2007-09-20 18:09:08 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-02 20:28:17 -04:00
										 |  |  | { "\u001234b" } [ 2 "\u001234bc" resize-string ] unit-test | 
					
						
							|  |  |  | { "\u001234bc\0\0\0" } [ 6 "\u001234bc" resize-string ] unit-test | 
					
						
							| 
									
										
										
										
											2008-02-01 19:36:13 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2007-09-20 18:09:08 -04:00
										 |  |  | ! Random tester found this | 
					
						
							| 
									
										
										
										
											2014-06-04 10:51:26 -04:00
										 |  |  | [ 2 -7 resize-string ] | 
					
						
							| 
									
										
										
										
											2016-03-22 10:56:41 -04:00
										 |  |  | [ ${ KERNEL-ERROR ERROR-TYPE 11 -7 } = ] must-fail-with | 
					
						
							| 
									
										
										
										
											2008-02-01 00:00:08 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-02-01 17:02:02 -05:00
										 |  |  | ! Make sure 24-bit strings work | 
					
						
							| 
									
										
										
										
											2008-02-01 00:00:08 -05:00
										 |  |  | "hello world" "s" set
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-02 20:28:17 -04:00
										 |  |  | { } [ 0x1234 1 "s" get set-nth ] unit-test | 
					
						
							|  |  |  | { 0x1234 } [ 1 "s" get nth ] unit-test | 
					
						
							| 
									
										
										
										
											2011-08-25 02:42:02 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-02 20:28:17 -04:00
										 |  |  | { } [ 0x4321 3 "s" get set-nth ] unit-test | 
					
						
							|  |  |  | { 0x4321 } [ 3 "s" get nth ] unit-test | 
					
						
							| 
									
										
										
										
											2008-02-01 00:00:08 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-02 20:28:17 -04:00
										 |  |  | { } [ 0x654321 5 "s" get set-nth ] unit-test | 
					
						
							|  |  |  | { 0x654321 } [ 5 "s" get nth ] unit-test | 
					
						
							| 
									
										
										
										
											2011-07-20 16:52:42 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-02 20:28:17 -04:00
										 |  |  | { | 
					
						
							| 
									
										
										
										
											2008-02-01 00:00:08 -05:00
										 |  |  |     { | 
					
						
							|  |  |  |         CHAR: h
 | 
					
						
							| 
									
										
										
										
											2011-11-23 21:49:33 -05:00
										 |  |  |         0x1234
 | 
					
						
							| 
									
										
										
										
											2008-02-01 00:00:08 -05:00
										 |  |  |         CHAR: l
 | 
					
						
							| 
									
										
										
										
											2011-11-23 21:49:33 -05:00
										 |  |  |         0x4321
 | 
					
						
							| 
									
										
										
										
											2008-02-01 00:00:08 -05:00
										 |  |  |         CHAR: o
 | 
					
						
							| 
									
										
										
										
											2011-11-23 21:49:33 -05:00
										 |  |  |         0x654321
 | 
					
						
							| 
									
										
										
										
											2008-02-01 00:00:08 -05:00
										 |  |  |         CHAR: w
 | 
					
						
							|  |  |  |         CHAR: o
 | 
					
						
							|  |  |  |         CHAR: r
 | 
					
						
							|  |  |  |         CHAR: l
 | 
					
						
							|  |  |  |         CHAR: d
 | 
					
						
							|  |  |  |     } | 
					
						
							| 
									
										
										
										
											2015-07-02 20:28:17 -04:00
										 |  |  | } [ | 
					
						
							| 
									
										
										
										
											2008-02-01 00:00:08 -05:00
										 |  |  |     "s" get >array
 | 
					
						
							|  |  |  | ] unit-test | 
					
						
							| 
									
										
										
										
											2008-02-01 17:02:02 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-04-25 20:19:50 -04:00
										 |  |  | ! Make sure string initialization works | 
					
						
							| 
									
										
										
										
											2015-07-02 20:28:17 -04:00
										 |  |  | { 0x123456 } [ 100 0x123456 <string> first ] unit-test | 
					
						
							| 
									
										
										
										
											2010-04-25 20:19:50 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-02-01 17:02:02 -05:00
										 |  |  | ! Make sure we clear aux vector when storing octets | 
					
						
							| 
									
										
										
										
											2015-07-02 20:28:17 -04:00
										 |  |  | { "\u123456hi" } [ "ih\u123456" clone reverse! ] unit-test | 
					
						
							| 
									
										
										
										
											2008-02-01 17:02:02 -05:00
										 |  |  | 
 | 
					
						
							|  |  |  | ! Make sure aux vector is not shared | 
					
						
							| 
									
										
										
										
											2015-07-02 20:28:17 -04:00
										 |  |  | { "\udeadbe" } [ | 
					
						
							| 
									
										
										
										
											2008-02-02 16:00:05 -05:00
										 |  |  |     "\udeadbe" clone
 | 
					
						
							|  |  |  |     CHAR: \u123456 over clone set-first
 | 
					
						
							| 
									
										
										
										
											2008-02-01 17:02:02 -05:00
										 |  |  | ] unit-test | 
					
						
							| 
									
										
										
										
											2008-04-13 10:20:19 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  | ! Regressions | 
					
						
							| 
									
										
										
										
											2015-07-02 20:28:17 -04:00
										 |  |  | { } [ | 
					
						
							| 
									
										
										
										
											2008-04-13 10:20:19 -04:00
										 |  |  |     [ | 
					
						
							|  |  |  |         4 [ | 
					
						
							| 
									
										
										
										
											2008-06-13 02:51:46 -04:00
										 |  |  |             100 [ "obdurak" clone ] replicate
 | 
					
						
							| 
									
										
										
										
											2008-04-13 10:20:19 -04:00
										 |  |  |             gc | 
					
						
							|  |  |  |             dup [ | 
					
						
							|  |  |  |                 1234 0 rot set-string-nth | 
					
						
							|  |  |  |             ] each
 | 
					
						
							|  |  |  |             1000 [ | 
					
						
							|  |  |  |                 1000 f <array> drop
 | 
					
						
							|  |  |  |             ] times
 | 
					
						
							|  |  |  |             .
 | 
					
						
							|  |  |  |         ] times
 | 
					
						
							| 
									
										
										
										
											2009-01-13 20:25:44 -05:00
										 |  |  |     ] with-null-writer | 
					
						
							| 
									
										
										
										
											2008-04-13 10:20:19 -04:00
										 |  |  | ] unit-test | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-02 20:28:17 -04:00
										 |  |  | { t } [ | 
					
						
							| 
									
										
										
										
											2008-04-13 10:20:19 -04:00
										 |  |  |     10000 [ | 
					
						
							|  |  |  |         drop
 | 
					
						
							|  |  |  |         300 100 CHAR: \u123456 | 
					
						
							|  |  |  |         [ <string> clone resize-string first ] keep =
 | 
					
						
							| 
									
										
										
										
											2010-01-14 10:10:13 -05:00
										 |  |  |     ] all-integers?
 | 
					
						
							| 
									
										
										
										
											2008-04-13 10:20:19 -04:00
										 |  |  | ] unit-test | 
					
						
							| 
									
										
										
										
											2011-08-25 02:42:02 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  | "X" "s" set
 | 
					
						
							| 
									
										
										
										
											2015-07-02 20:28:17 -04:00
										 |  |  | { } [ 0x100,0000 0 "s" get set-nth ] unit-test | 
					
						
							|  |  |  | { 0 } [ 0 "s" get nth ] unit-test | 
					
						
							| 
									
										
										
										
											2011-08-25 02:42:02 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-02 20:28:17 -04:00
										 |  |  | { } [ -1 0 "s" get set-nth ] unit-test | 
					
						
							|  |  |  | { 0x7fffff } [ 0 "s" get nth ] unit-test |