]> granicus.if.org Git - php/commitdiff
Added UCS4 test
authorYasuo Ohgaki <yohgaki@php.net>
Sun, 3 Feb 2002 02:18:30 +0000 (02:18 +0000)
committerYasuo Ohgaki <yohgaki@php.net>
Sun, 3 Feb 2002 02:18:30 +0000 (02:18 +0000)
ext/iconv/tests/001.phpt
ext/iconv/tests/002.inc [new file with mode: 0644]
ext/iconv/tests/002.phpt [new file with mode: 0644]
ext/iconv/tests/skipif.inc [new file with mode: 0644]

index 6574d07cf9660fd56fb280e8fd91af34955346b3..a6f41199ae89f40c39b835d7ecce28c731c7e1bf 100644 (file)
@@ -1,7 +1,7 @@
 --TEST--
 iconv test
 --SKIPIF--
-<?php if (!extension_loaded("iconv")) print "skip"; ?>
+<?php include('skipif.inc'); ?>
 --POST--
 --GET--
 --FILE--
diff --git a/ext/iconv/tests/002.inc b/ext/iconv/tests/002.inc
new file mode 100644 (file)
index 0000000..f7ae53d
--- /dev/null
@@ -0,0 +1,14 @@
+<?php
+/*
+Expected output:
+&#97;&#98;&#99;&#100;
+abcd
+*/
+
+   $s = unpack("V*", iconv("ascii","UCS-4LE", "abcd"));
+   foreach($s as $c) { print "&#$c;"; } print "\n";
+
+   $s = pack("NNNN", 97, 98, 99, 100);
+   $q = iconv("UCS-4BE", "ascii", $s);
+   print $q; print "\n";
+?>
diff --git a/ext/iconv/tests/002.phpt b/ext/iconv/tests/002.phpt
new file mode 100644 (file)
index 0000000..a06399c
--- /dev/null
@@ -0,0 +1,12 @@
+--TEST--
+iconv test
+--SKIPIF--
+<?php include('skipif.inc'); ?>
+--POST--
+--GET--
+--FILE--
+<?php include('002.inc'); ?>
+--EXPECT--
+Expected output:
+&#97;&#98;&#99;&#100;
+abcd
diff --git a/ext/iconv/tests/skipif.inc b/ext/iconv/tests/skipif.inc
new file mode 100644 (file)
index 0000000..4fea1b0
--- /dev/null
@@ -0,0 +1,11 @@
+<?php
+// This script prints "skip" if condition does not meet.
+
+if (!extension_loaded("iconv") && ini_get("enable_dl")) {
+  $dlext = (substr(PHP_OS, 0, 3) == "WIN") ? ".dll" : ".so";
+  @dl("iconv$dlext");
+}
+if (!extension_loaded("iconv")) {
+    die("skip\n");
+}
+?>
\ No newline at end of file