private function DecoderTest::checkDecoding in Smart IP 7.2
Same name and namespace in other branches
- 6.2 includes/vendor/maxmind-db/reader/tests/MaxMind/Db/Test/Reader/DecoderTest.php \MaxMind\Db\Test\Reader\DecoderTest::checkDecoding()
2 calls to DecoderTest::checkDecoding()
- DecoderTest::validateTypeDecoding in includes/
vendor/ maxmind-db/ reader/ tests/ MaxMind/ Db/ Test/ Reader/ DecoderTest.php - DecoderTest::validateTypeDecodingList in includes/
vendor/ maxmind-db/ reader/ tests/ MaxMind/ Db/ Test/ Reader/ DecoderTest.php
File
- includes/
vendor/ maxmind-db/ reader/ tests/ MaxMind/ Db/ Test/ Reader/ DecoderTest.php, line 349
Class
Namespace
MaxMind\Db\Test\ReaderCode
private function checkDecoding($type, $input, $expected, $name = null) {
$name = $name || $expected;
$description = "decoded {$type} - {$name}";
$handle = fopen('php://memory', 'rw');
foreach ($input as $byte) {
fwrite($handle, pack('C', $byte));
}
fseek($handle, 0);
$decoder = new Decoder($handle, 0, true);
list($actual) = $decoder
->decode(0);
if ($type == 'float') {
$actual = round($actual, 2);
}
$this
->assertEquals($expected, $actual, $description);
}