private function ReaderTest::checkIpV4 in Smart IP 6.2
Same name and namespace in other branches
- 7.2 includes/vendor/maxmind-db/reader/tests/MaxMind/Db/Test/ReaderTest.php \MaxMind\Db\Test\Reader\ReaderTest::checkIpV4()
1 call to ReaderTest::checkIpV4()
- ReaderTest::testReader in includes/
vendor/ maxmind-db/ reader/ tests/ MaxMind/ Db/ Test/ ReaderTest.php
File
- includes/
vendor/ maxmind-db/ reader/ tests/ MaxMind/ Db/ Test/ ReaderTest.php, line 315
Class
Namespace
MaxMind\Db\Test\ReaderCode
private function checkIpV4(Reader $reader, $fileName) {
for ($i = 0; $i <= 5; $i++) {
$address = '1.1.1.' . pow(2, $i);
$this
->assertEquals(array(
'ip' => $address,
), $reader
->get($address), 'found expected data record for ' . $address . ' in ' . $fileName);
}
$pairs = array(
'1.1.1.3' => '1.1.1.2',
'1.1.1.5' => '1.1.1.4',
'1.1.1.7' => '1.1.1.4',
'1.1.1.9' => '1.1.1.8',
'1.1.1.15' => '1.1.1.8',
'1.1.1.17' => '1.1.1.16',
'1.1.1.31' => '1.1.1.16',
);
foreach ($pairs as $keyAddress => $valueAddress) {
$data = array(
'ip' => $valueAddress,
);
$this
->assertEquals($data, $reader
->get($keyAddress), 'found expected data record for ' . $keyAddress . ' in ' . $fileName);
}
foreach (array(
'1.1.1.33',
'255.254.253.123',
) as $ip) {
$this
->assertNull($reader
->get($ip));
}
}