--- /dev/null
+--TEST--\r
+Test md5() function : basic functionality \r
+--FILE--\r
+<?php\r
+/* Prototype : string md5 ( string $str [, bool $raw_output= false ] )\r
+ * Description: Calculate the md5 hash of a string\r
+ * Source code: ext/standard/md5.c\r
+*/\r
+\r
+echo "*** Testing md5() : basic functionality ***\n";\r
+var_dump(md5(b"apple"));\r
+?>\r
+===DONE===\r
+--EXPECTF--\r
+*** Testing md5() : basic functionality ***\r
+string(32) "1f3870be274f6c49b3e31a0c6728957f"\r
+===DONE===\r
--- /dev/null
+--TEST--\r
+Test md5() function : basic functionality - with raw output\r
+--FILE--\r
+<?php\r
+/* Prototype : string md5 ( string $str [, bool $raw_output= false ] )\r
+ * Description: Calculate the md5 hash of a string\r
+ * Source code: ext/standard/md5.c\r
+*/\r
+\r
+echo "*** Testing md5() : basic functionality - with raw output***\n";\r
+$str = b"Hello World";\r
+$md5_raw = md5($str, true);\r
+var_dump(bin2hex($md5_raw));\r
+\r
+$md5 = md5($str, false);\r
+ \r
+if (strcmp(bin2hex($md5_raw), $md5) == 0 ) {\r
+ echo "TEST PASSED\n";\r
+} else {\r
+ echo "TEST FAILED\n";\r
+ var_dump($md5_raw, $md5);\r
+}\r
+\r
+?>\r
+===DONE===\r
+--EXPECT--\r
+*** Testing md5() : basic functionality - with raw output***\r
+string(32) "b10a8db164e0754105b7a99be72e3fe5"\r
+TEST PASSED\r
+===DONE===
\ No newline at end of file
--- /dev/null
+--TEST--\r
+Test md5() function : error conditions\r
+--FILE--\r
+<?php\r
+/* Prototype : string md5 ( string $str [, bool $raw_output= false ] )\r
+ * Description: Calculate the md5 hash of a string\r
+ * Source code: ext/standard/md5.c\r
+*/\r
+\r
+echo "*** Testing md5() : error conditions ***\n";\r
+\r
+echo "\n-- Testing md5() function with no arguments --\n";\r
+var_dump( md5());\r
+\r
+echo "\n-- Testing md5() function with more than expected no. of arguments --\n";\r
+$str = "Hello World";\r
+$raw_output = true;\r
+$extra_arg = 10;\r
+\r
+var_dump(md5($str, $raw_output, $extra_arg));\r
+?>\r
+===DONE==\r
+--EXPECTF--\r
+*** Testing md5() : error conditions ***\r
+\r
+-- Testing md5() function with no arguments --\r
+\r
+Warning: md5() expects at least 1 parameter, 0 given in %s on line %d\r
+NULL\r
+\r
+-- Testing md5() function with more than expected no. of arguments --\r
+\r
+Warning: md5() expects at most 2 parameters, 3 given in %s on line %d\r
+NULL\r
+===DONE==
\ No newline at end of file