Skip to content
This repository has been archived by the owner on May 29, 2018. It is now read-only.

Commit

Permalink
Added two print methods to aid in debuggin.
Browse files Browse the repository at this point in the history
  • Loading branch information
bramp committed Feb 15, 2016
1 parent 304737b commit 4f75ec8
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions tests/phpunit_base.php
Expand Up @@ -8,6 +8,30 @@ function stringToStream($str) {
return $fp;
}



function print_bytes($bytes) {
$len = strlen($bytes);
for ($i = 0; $i < $len; $i++) {
echo sprintf("%02X ", ord($bytes[$i]));
}
echo "\n";
}

function print_varint_binary($bytes) {
$len = strlen($bytes);
for ($i = 0; $i < $len; $i++) {
$c = ord($bytes[$i]);
if ($c >= 0x80) {
echo sprintf("%07b ", $c & 0x7F);
} else {
echo sprintf("%07b ", $c);
}
}
echo "\n";
}


/**
* Tests if the number represented by this string has an exact float representation.
*
Expand Down

0 comments on commit 4f75ec8

Please sign in to comment.