summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYasuo Ohgaki <yohgaki@php.net>2002-02-03 02:18:30 +0000
committerYasuo Ohgaki <yohgaki@php.net>2002-02-03 02:18:30 +0000
commit665d38629b818d2d24f9c532c183b85b3492b464 (patch)
treedbcb386a3ff638e12a87576d8792951d6c93465c
parentbb5e06b14ef4be37a1f6de5f4bf33381466cb3d5 (diff)
downloadphp-git-665d38629b818d2d24f9c532c183b85b3492b464.tar.gz
Added UCS4 test
-rw-r--r--ext/iconv/tests/001.phpt2
-rw-r--r--ext/iconv/tests/002.inc14
-rw-r--r--ext/iconv/tests/002.phpt12
-rw-r--r--ext/iconv/tests/skipif.inc11
4 files changed, 38 insertions, 1 deletions
diff --git a/ext/iconv/tests/001.phpt b/ext/iconv/tests/001.phpt
index 6574d07cf9..a6f41199ae 100644
--- a/ext/iconv/tests/001.phpt
+++ b/ext/iconv/tests/001.phpt
@@ -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
index 0000000000..f7ae53d4bd
--- /dev/null
+++ b/ext/iconv/tests/002.inc
@@ -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
index 0000000000..a06399c44c
--- /dev/null
+++ b/ext/iconv/tests/002.phpt
@@ -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
index 0000000000..4fea1b0d43
--- /dev/null
+++ b/ext/iconv/tests/skipif.inc
@@ -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