com php-src: Added basic and error tests for hex2bin function: ext/standard/tests/strings/hex2bin_basic.phpt ext/stand
ard/tests/strings/hex2bin_error.phpt

From: Date: Mon, 29 Jun 2015 21:10:50 +0000
Subject: com php-src: Added basic and error tests for hex2bin function: ext/standard/tests/strings/hex2bin_basic.phpt ext/stand
ard/tests/strings/hex2bin_error.phpt
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-87634@lists.php.net to get a copy of this message
Commit: d2bc45f6b30542adc5d17fdee604822e011be333 Author: Edgar R. Sandi <edgar.r.sandi@gmail.com> Mon, 29 Jun 2015 14:33:21 -0300 Committer: Christoph M. Becker <cmb@php.net> Mon, 29 Jun 2015 23:10:50 +0200 Parents: a8d61ab7f09f66b6d95e705ad396653cf323cb31 Branches: PHP-5.6 master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=d2bc45f6b30542adc5d17fdee604822e011be333 Log: Added basic and error tests for hex2bin function Changed paths: A ext/standard/tests/strings/hex2bin_basic.phpt A ext/standard/tests/strings/hex2bin_error.phpt Diff: diff --git a/ext/standard/tests/strings/hex2bin_basic.phpt b/ext/standard/tests/strings/hex2bin_basic.phpt new file mode 100644 index 0000000..8f3437d --- /dev/null +++ b/ext/standard/tests/strings/hex2bin_basic.phpt @@ -0,0 +1,18 @@ +--TEST-- +hex2bin(); function test +--CREDITS-- +edgarsandi - <edgar.r.sandi@gmail.com> +--FILE-- +<?php + +var_dump(bin2hex(hex2bin('012345')) == '012345'); +var_dump(bin2hex(hex2bin('abc123')) == 'abc123'); +var_dump(bin2hex(hex2bin('123abc')) == '123abc'); +var_dump(bin2hex(hex2bin('FFFFFF')) == 'ffffff'); + +?> +--EXPECTF-- +bool(true) +bool(true) +bool(true) +bool(true) diff --git a/ext/standard/tests/strings/hex2bin_error.phpt b/ext/standard/tests/strings/hex2bin_error.phpt new file mode 100644 index 0000000..054aa38 --- /dev/null +++ b/ext/standard/tests/strings/hex2bin_error.phpt @@ -0,0 +1,15 @@ +--TEST-- +hex2bin(); function test +--CREDITS-- +edgarsandi - <edgar.r.sandi@gmail.com> +--FILE-- +<?php +var_dump(hex2bin('AH')); +var_dump(hex2bin('HA')); +?> +--EXPECTF-- +Warning: hex2bin(): Input string must be hexadecimal string in %s on line %d +bool(false) + +Warning: hex2bin(): Input string must be hexadecimal string in %s on line %d +bool(false)

« previous php.cvs (#87634) next »