You are here

private function ReaderTest::checkIpV6 in Smart IP 7.2

Same name and namespace in other branches
  1. 6.2 includes/vendor/maxmind-db/reader/tests/MaxMind/Db/Test/ReaderTest.php \MaxMind\Db\Test\Reader\ReaderTest::checkIpV6()
1 call to ReaderTest::checkIpV6()
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 353

Class

ReaderTest

Namespace

MaxMind\Db\Test\Reader

Code

private function checkIpV6(Reader $reader, $fileName) {
  $subnets = array(
    '::1:ffff:ffff',
    '::2:0:0',
    '::2:0:40',
    '::2:0:50',
    '::2:0:58',
  );
  foreach ($subnets as $address) {
    $this
      ->assertEquals(array(
      'ip' => $address,
    ), $reader
      ->get($address), 'found expected data record for ' . $address . ' in ' . $fileName);
  }
  $pairs = array(
    '::2:0:1' => '::2:0:0',
    '::2:0:33' => '::2:0:0',
    '::2:0:39' => '::2:0:0',
    '::2:0:41' => '::2:0:40',
    '::2:0:49' => '::2:0:40',
    '::2:0:52' => '::2:0:50',
    '::2:0:57' => '::2:0:50',
    '::2:0:59' => '::2:0:58',
  );
  foreach ($pairs as $keyAddress => $valueAddress) {
    $this
      ->assertEquals(array(
      'ip' => $valueAddress,
    ), $reader
      ->get($keyAddress), 'found expected data record for ' . $keyAddress . ' in ' . $fileName);
  }
  foreach (array(
    '1.1.1.33',
    '255.254.253.123',
    '89fa::',
  ) as $ip) {
    $this
      ->assertNull($reader
      ->get($ip));
  }
}