/** * @dataProvider getIPv4Data * @group Core * @group IP */ public function testIsIPv4($ip, $bool) { $this->assertEquals($bool, Piwik_IP::isIPv4($ip), bin2hex($ip)); }
function test_isIPv4() { // a valid network address is either 4 or 16 bytes; those lines are intentionally left blank ;) $tests = array(null => false, "" => false, "" => true, "" => true, "��" => true, "����" => true, "���" => false, "��" => false, "��" => false, '-1062731520' => false, '3232235776' => false, '168430090' => false, '9999' => true, "9999" => true, '999' => false, "999" => false); foreach ($tests as $N => $bool) { $this->assertEqual(Piwik_IP::isIPv4($N), $bool, bin2hex($N)); } }