Skip to content

Commit d2bc45f

Browse files
edgarsandicmb69
authored andcommitted
Added basic and error tests for hex2bin function
1 parent a8d61ab commit d2bc45f

File tree

2 files changed

+33
-0
lines changed

2 files changed

+33
-0
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
--TEST--
2+
hex2bin(); function test
3+
--CREDITS--
4+
edgarsandi - <edgar.r.sandi@gmail.com>
5+
--FILE--
6+
<?php
7+
8+
var_dump(bin2hex(hex2bin('012345')) == '012345');
9+
var_dump(bin2hex(hex2bin('abc123')) == 'abc123');
10+
var_dump(bin2hex(hex2bin('123abc')) == '123abc');
11+
var_dump(bin2hex(hex2bin('FFFFFF')) == 'ffffff');
12+
13+
?>
14+
--EXPECTF--
15+
bool(true)
16+
bool(true)
17+
bool(true)
18+
bool(true)
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
--TEST--
2+
hex2bin(); function test
3+
--CREDITS--
4+
edgarsandi - <edgar.r.sandi@gmail.com>
5+
--FILE--
6+
<?php
7+
var_dump(hex2bin('AH'));
8+
var_dump(hex2bin('HA'));
9+
?>
10+
--EXPECTF--
11+
Warning: hex2bin(): Input string must be hexadecimal string in %s on line %d
12+
bool(false)
13+
14+
Warning: hex2bin(): Input string must be hexadecimal string in %s on line %d
15+
bool(false)

0 commit comments

Comments
 (0)