]> granicus.if.org Git - php/commitdiff
This commit was manufactured by cvs2svn to create branch 'PHP_4_3'.
authorSVN Migration <svn@php.net>
Wed, 20 Nov 2002 06:48:59 +0000 (06:48 +0000)
committerSVN Migration <svn@php.net>
Wed, 20 Nov 2002 06:48:59 +0000 (06:48 +0000)
ext/mhash/tests/001.phpt [new file with mode: 0644]
ext/mhash/tests/002.phpt [new file with mode: 0644]
ext/mhash/tests/003.phpt [new file with mode: 0644]
ext/mhash/tests/skip.inc [new file with mode: 0644]
ext/standard/tests/general_functions/009.phpt [new file with mode: 0644]

diff --git a/ext/mhash/tests/001.phpt b/ext/mhash/tests/001.phpt
new file mode 100644 (file)
index 0000000..57f50c0
--- /dev/null
@@ -0,0 +1,67 @@
+--TEST--
+mhash() test
+--SKIPIF--
+<?php
+       include "skip.inc";
+?>
+--FILE--
+<?php
+
+$supported_hash_al = array(
+"MHASH_MD5",
+"MHASH_SHA1",
+"MHASH_HAVAL256",
+"MHASH_HAVAL192",
+"MHASH_HAVAL224",
+"MHASH_HAVAL160",
+"MHASH_RIPEMD160",
+"MHASH_GOST",
+"MHASH_TIGER",
+"MHASH_CRC32",
+"MHASH_CRC32B"
+);
+
+       $data = "This is the test of the mhash extension...";
+
+       foreach ($supported_hash_al as $hash) {
+               echo $hash . "\n";
+               var_dump(mhash(constant($hash), $data));
+               echo "\n";
+       }
+?>
+--EXPECT--
+MHASH_MD5
+string(16) "-\9bÛ\91ùN\96ÙÄâ®S*Ì\93j"
+
+MHASH_SHA1
+string(20) "/\93AåZ\90\83íõI{ø;£Û\81*}à£"
+
+MHASH_HAVAL256
+string(32) "²Uþÿ\ 1­d\e'5\8dÇ\90\9bÆ\95¡ü¥;Ýýúñ\90 ²u\92\87\93¯"
+
+MHASH_HAVAL192
+string(24) "Lè7ÞH\1e\1e0   *²Æ\10\ 5p\94É\88ß×Û\1e\ 1Í"
+
+MHASH_HAVAL224
+string(28) "SbÑ\85gR¿,\13\9b²Öý×r¹Å\15ÈÎ^È&\95&K\85á"
+
+MHASH_HAVAL160
+string(20) "Ƴo\87u\v\18Wi\81¼\17´ò"q\94{ùË"
+
+MHASH_RIPEMD160
+string(20) "lGCZ¡ÓYķƯF4\9f\f>\12XX="
+
+MHASH_GOST
+string(32) "\10\e
+%Rνõ\13|­ñQGò\1eU¶C)5»\9c,\ 3Çâ\8d\18\8b-\9e"
+
+MHASH_TIGER
+string(24) "\95:Ãy\9a\ 1¹ýë\91®«\97 ~g9\»T0\và
+"
+
+MHASH_CRC32
+string(4) "\83\ 4\1d¸"
+
+MHASH_CRC32B
+string(4) "¤·Zß"
+
diff --git a/ext/mhash/tests/002.phpt b/ext/mhash/tests/002.phpt
new file mode 100644 (file)
index 0000000..3dcdab2
--- /dev/null
@@ -0,0 +1,28 @@
+--TEST--
+mhash_get_block_size() & mhash_get_hash_name() test
+--SKIPIF--
+<?php
+       include "skip.inc";
+?>
+--FILE--
+<?php
+       $hc = mhash_count() + 1;
+       
+       for ($i=0; $i<$hc; $i++) {
+               if (($hn = mhash_get_hash_name($i))) {
+                       echo $hn . "\t->\t" . mhash_get_block_size($i) . "\n";
+               }
+       }
+?>
+--EXPECT--
+CRC32  ->      4
+MD5    ->      16
+SHA1   ->      20
+HAVAL256       ->      32
+RIPEMD160      ->      20
+TIGER  ->      24
+GOST   ->      32
+CRC32B ->      4
+HAVAL224       ->      28
+HAVAL192       ->      24
+HAVAL160       ->      20
diff --git a/ext/mhash/tests/003.phpt b/ext/mhash/tests/003.phpt
new file mode 100644 (file)
index 0000000..677142e
Binary files /dev/null and b/ext/mhash/tests/003.phpt differ
diff --git a/ext/mhash/tests/skip.inc b/ext/mhash/tests/skip.inc
new file mode 100644 (file)
index 0000000..81912d2
--- /dev/null
@@ -0,0 +1,5 @@
+<?php
+if (!extension_loaded("mhash")) {
+       die("skip mhash extension is not avaliable");
+}
+?>
\ No newline at end of file
diff --git a/ext/standard/tests/general_functions/009.phpt b/ext/standard/tests/general_functions/009.phpt
new file mode 100644 (file)
index 0000000..68c1f4d
--- /dev/null
@@ -0,0 +1,26 @@
+--TEST--
+SHA1
+--POST--
+--GET--
+--FILE--
+<?php
+function test($str) {
+       $res = sha1($str)."\n";
+       return $res;
+} 
+echo test("");
+echo test("a");
+echo test("abc");
+echo test("message digest");
+echo test("abcdefghijklmnopqrstuvwxyz");
+echo test("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789");
+echo test("12345678901234567890123456789012345678901234567890123456789012345678901234567890");
+?>
+--EXPECT--
+da39a3ee5e6b4b0d3255bfef95601890afd80709
+86f7e437faa5a7fce15d1ddcb9eaeaea377667b8
+a9993e364706816aba3e25717850c26c9cd0d89d
+c12252ceda8be8994d5fa0290a47231c1d16aae3
+32d10c7b8cf96570ca04ce37f2a19d84240d3a89
+761c457bf73b14d27e9e9265c46f4b4dda11f940
+50abf5706a150990a08b2c5ea40fa0e585554732