| 
									
										
										
										
											2008-05-25 13:40:12 -04:00
										 |  |  | USING: unicode.normalize kernel tools.test sequences | 
					
						
							| 
									
										
										
										
											2009-03-18 23:55:02 -04:00
										 |  |  | simple-flat-file io.encodings.utf8 io.files splitting math.parser | 
					
						
							| 
									
										
										
										
											2009-01-08 00:13:04 -05:00
										 |  |  | locals math quotations assocs combinators unicode.normalize.private ;
 | 
					
						
							| 
									
										
										
										
											2008-05-25 13:40:12 -04:00
										 |  |  | IN: unicode.normalize.tests | 
					
						
							| 
									
										
										
										
											2008-01-09 18:13:26 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-02-01 16:00:02 -05:00
										 |  |  | [ "ab\u000323\u000302cd" ] [ "ab\u000302" "\u000323cd" string-append ] unit-test | 
					
						
							| 
									
										
										
										
											2008-01-09 18:13:26 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-05-20 17:57:53 -04:00
										 |  |  | [ "ab\u00064b\u000347\u00034e\u00034d\u000346" ] [ "ab\u000346\u000347\u00064b\u00034e\u00034d" dup reorder ] unit-test | 
					
						
							| 
									
										
										
										
											2008-01-09 18:13:26 -05:00
										 |  |  | [ "hello" "hello" ] [ "hello" [ nfd ] keep nfkd ] unit-test | 
					
						
							| 
									
										
										
										
											2008-02-01 16:00:02 -05:00
										 |  |  | [ "\u00FB012\u002075\u00017F\u000323\u000307" "fi25s\u000323\u000307" ] | 
					
						
							|  |  |  | [ "\u00FB012\u002075\u001E9B\u000323" [ nfd ] keep nfkd ] unit-test | 
					
						
							| 
									
										
										
										
											2008-01-09 18:13:26 -05:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2008-02-01 16:00:02 -05:00
										 |  |  | [ "\u001E69" "s\u000323\u000307" ] [ "\u001E69" [ nfc ] keep nfd ] unit-test | 
					
						
							|  |  |  | [ "\u001E0D\u000307" ] [ "\u001E0B\u000323" nfc ] unit-test | 
					
						
							| 
									
										
										
										
											2008-01-09 18:13:26 -05:00
										 |  |  | 
 | 
					
						
							|  |  |  | [ 54620 ] [ 4370 4449 4523 jamo>hangul ] unit-test | 
					
						
							|  |  |  | [ 4370 4449 4523 ] [ 54620 hangul>jamo first3 ] unit-test | 
					
						
							|  |  |  | [ t ] [ 54620 hangul? ] unit-test | 
					
						
							|  |  |  | [ f ] [ 0 hangul? ] unit-test | 
					
						
							| 
									
										
										
										
											2008-02-01 16:00:02 -05:00
										 |  |  | [ "\u001112\u001161\u0011ab" ] [ "\u00d55c" nfd ] unit-test | 
					
						
							|  |  |  | [ "\u00d55c" ] [ "\u001112\u001161\u0011ab" nfc ] unit-test | 
					
						
							| 
									
										
										
										
											2008-05-25 13:40:12 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  | : parse-test ( -- tests )
 | 
					
						
							| 
									
										
										
										
											2009-03-18 23:55:02 -04:00
										 |  |  |     "vocab:unicode/normalize/NormalizationTest.txt" data | 
					
						
							|  |  |  |     [ 5 head [ " " split [ hex> ] "" map-as ] map ] map ;
 | 
					
						
							| 
									
										
										
										
											2008-05-25 13:40:12 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  | :: assert= ( test spec quot -- )
 | 
					
						
							|  |  |  |     spec [ | 
					
						
							|  |  |  |         [ | 
					
						
							| 
									
										
										
										
											2009-08-13 20:21:44 -04:00
										 |  |  |             [ 1 - test nth ] bi@
 | 
					
						
							| 
									
										
										
										
											2008-05-25 13:40:12 -04:00
										 |  |  |             [ 1quotation ] [ quot curry ] bi* unit-test | 
					
						
							|  |  |  |         ] with each
 | 
					
						
							|  |  |  |     ] assoc-each ;
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | : run-line ( test -- )
 | 
					
						
							|  |  |  |     { | 
					
						
							|  |  |  |         [ { { 2 { 1 2 3 } } { 4 { 4 5 } } } [ nfc ] assert= ] | 
					
						
							|  |  |  |         [ { { 3 { 1 2 3 } } { 5 { 4 5 } } } [ nfd ] assert= ] | 
					
						
							|  |  |  |         [ { { 4 { 1 2 3 4 5 } } } [ nfkc ] assert= ] | 
					
						
							|  |  |  |         [ { { 5 { 1 2 3 4 5 } } } [ nfkd ] assert= ] | 
					
						
							|  |  |  |     } cleave ;
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-01-06 17:25:12 -05:00
										 |  |  | parse-test [ run-line ] each
 |