summaryrefslogtreecommitdiff
path: root/ext/Unicode/Normalize/t/test.t
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2001-11-09 00:23:40 +0000
committerJarkko Hietaniemi <jhi@iki.fi>2001-11-09 00:23:40 +0000
commitac5ea53171baa7dab1a92df1eacf8d2fe19cbdbb (patch)
tree5ce2221e6a7335594861f38233d4d665313a7c82 /ext/Unicode/Normalize/t/test.t
parent61a515a61510e728f2014674d12cb94cb5a90834 (diff)
downloadperl-ac5ea53171baa7dab1a92df1eacf8d2fe19cbdbb.tar.gz
Upgrade to Unicode::Normalize 0.10, now in XS.
The CPAN distribution has both pm and XS implementations, and for performance reasons we choose the XS. Another reason to choose the XS is that it doesn't require Lingua::KO::Hangul::Util, which means that we can delete that-- which in turn means that Unicode::UCD cannot expect that: support it, but don't expect. Ditto Unicode::Collate. Note that Unicode::Normalize Makefile.PL and Normalize.xs have been modified from the CPAN 0.10 versions: the first one to be simpler (no pm) and clean up the generated unf*.h files, the second one to quench compiler grumblings. Must notify Sadahiro about these changes. p4raw-id: //depot/perl@12909
Diffstat (limited to 'ext/Unicode/Normalize/t/test.t')
-rw-r--r--ext/Unicode/Normalize/t/test.t43
1 files changed, 43 insertions, 0 deletions
diff --git a/ext/Unicode/Normalize/t/test.t b/ext/Unicode/Normalize/t/test.t
new file mode 100644
index 0000000000..5544a3b13b
--- /dev/null
+++ b/ext/Unicode/Normalize/t/test.t
@@ -0,0 +1,43 @@
+# Before `make install' is performed this script should be runnable with
+# `make test'. After `make install' it should work as `perl test.pl'
+
+#########################
+
+use Test;
+use strict;
+use warnings;
+BEGIN { plan tests => 18 };
+use Unicode::Normalize;
+ok(1); # If we made it this far, we're ok.
+
+#########################
+
+ok(NFC(""), "");
+ok(NFD(""), "");
+
+sub hexNFC {
+ join " ", map sprintf("%04X", $_),
+ unpack 'U*', NFC pack 'U*', map hex(), split ' ', shift;
+}
+sub hexNFD {
+ join " ", map sprintf("%04X", $_),
+ unpack 'U*', NFD pack 'U*', map hex(), split ' ', shift;
+}
+
+ok(hexNFC("0061 0315 0300 05AE 05C4 0062"), "00E0 05AE 05C4 0315 0062");
+ok(hexNFC("00E0 05AE 05C4 0315 0062"), "00E0 05AE 05C4 0315 0062");
+ok(hexNFC("0061 05AE 0300 05C4 0315 0062"), "00E0 05AE 05C4 0315 0062");
+ok(hexNFC("0045 0304 0300 AC00 11A8"), "1E14 AC01");
+ok(hexNFC("1100 1161 1100 1173 11AF"), "AC00 AE00");
+ok(hexNFC("1100 0300 1161 1173 11AF"), "1100 0300 1161 1173 11AF");
+
+ok(hexNFD("0061 0315 0300 05AE 05C4 0062"), "0061 05AE 0300 05C4 0315 0062");
+ok(hexNFD("00E0 05AE 05C4 0315 0062"), "0061 05AE 0300 05C4 0315 0062");
+ok(hexNFD("0061 05AE 0300 05C4 0315 0062"), "0061 05AE 0300 05C4 0315 0062");
+ok(hexNFC("0061 05C4 0315 0300 05AE 0062"), "0061 05AE 05C4 0300 0315 0062");
+ok(hexNFC("0061 05AE 05C4 0300 0315 0062"), "0061 05AE 05C4 0300 0315 0062");
+ok(hexNFD("0061 05C4 0315 0300 05AE 0062"), "0061 05AE 05C4 0300 0315 0062");
+ok(hexNFD("0061 05AE 05C4 0300 0315 0062"), "0061 05AE 05C4 0300 0315 0062");
+ok(hexNFC("0000 0041 0000 0000"), "0000 0041 0000 0000");
+ok(hexNFD("0000 0041 0000 0000"), "0000 0041 0000 0000");
+