選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

44 行
2.1KB

  1. <?php
  2. // test case is from Feyd's IPv6 implementation
  3. // we ought to disallow non-routable addresses
  4. class HTMLPurifier_AttrDef_URI_IPv6Test extends HTMLPurifier_AttrDefHarness
  5. {
  6. public function test()
  7. {
  8. $this->def = new HTMLPurifier_AttrDef_URI_IPv6();
  9. $this->assertDef('2001:DB8:0:0:8:800:200C:417A'); // unicast, full
  10. $this->assertDef('FF01:0:0:0:0:0:0:101'); // multicast, full
  11. $this->assertDef('0:0:0:0:0:0:0:1'); // loopback, full
  12. $this->assertDef('0:0:0:0:0:0:0:0'); // unspecified, full
  13. $this->assertDef('2001:DB8::8:800:200C:417A'); // unicast, compressed
  14. $this->assertDef('FF01::101'); // multicast, compressed
  15. $this->assertDef('::1'); // loopback, compressed, non-routable
  16. $this->assertDef('::'); // unspecified, compressed, non-routable
  17. $this->assertDef('0:0:0:0:0:0:13.1.68.3'); // IPv4-compatible IPv6 address, full, deprecated
  18. $this->assertDef('0:0:0:0:0:FFFF:129.144.52.38'); // IPv4-mapped IPv6 address, full
  19. $this->assertDef('::13.1.68.3'); // IPv4-compatible IPv6 address, compressed, deprecated
  20. $this->assertDef('::FFFF:129.144.52.38'); // IPv4-mapped IPv6 address, compressed
  21. $this->assertDef('2001:0DB8:0000:CD30:0000:0000:0000:0000/60'); // full, with prefix
  22. $this->assertDef('2001:0DB8::CD30:0:0:0:0/60'); // compressed, with prefix
  23. $this->assertDef('2001:0DB8:0:CD30::/60'); // compressed, with prefix #2
  24. $this->assertDef('::/128'); // compressed, unspecified address type, non-routable
  25. $this->assertDef('::1/128'); // compressed, loopback address type, non-routable
  26. $this->assertDef('FF00::/8'); // compressed, multicast address type
  27. $this->assertDef('FE80::/10'); // compressed, link-local unicast, non-routable
  28. $this->assertDef('FEC0::/10'); // compressed, site-local unicast, deprecated
  29. $this->assertDef('2001:DB8:0:0:8:800:200C:417A:221', false); // unicast, full
  30. $this->assertDef('FF01::101::2', false); //multicast, compressed
  31. $this->assertDef('', false); // nothing
  32. }
  33. }
  34. // vim: et sw=4 sts=4