spec/util_ip_spec.lua
changeset 13432 dc1ad5f3f597
parent 12938 c6dffebab2f8
equal deleted inserted replaced
13431:9677df320992 13432:dc1ad5f3f597
    34 
    34 
    35 			assert.are.equal(match(_"127.0.0.1", _"127.0.0.1"), true, "simple ip");
    35 			assert.are.equal(match(_"127.0.0.1", _"127.0.0.1"), true, "simple ip");
    36 
    36 
    37 			assert.are.equal(match(_"8.8.8.8", _"8.8.0.0", 16), true);
    37 			assert.are.equal(match(_"8.8.8.8", _"8.8.0.0", 16), true);
    38 			assert.are.equal(match(_"8.8.4.4", _"8.8.0.0", 16), true);
    38 			assert.are.equal(match(_"8.8.4.4", _"8.8.0.0", 16), true);
       
    39 
       
    40 			assert.are.equal(match(_"fe80::1", _"fec0::", 10), false);
    39 		end);
    41 		end);
    40 	end);
    42 	end);
    41 
    43 
    42 	describe("#parse_cidr()", function()
    44 	describe("#parse_cidr()", function()
    43 		it("should work", function()
    45 		it("should work", function()
    96 
    98 
    97 			assert_cpl6("::1", "::1", 128);
    99 			assert_cpl6("::1", "::1", 128);
    98 			assert_cpl6("abcd::1", "abcd::1", 128);
   100 			assert_cpl6("abcd::1", "abcd::1", 128);
    99 			assert_cpl6("abcd::abcd", "abcd::", 112);
   101 			assert_cpl6("abcd::abcd", "abcd::", 112);
   100 			assert_cpl6("abcd::abcd", "abcd::abcd:abcd", 96);
   102 			assert_cpl6("abcd::abcd", "abcd::abcd:abcd", 96);
       
   103 
       
   104 			assert_cpl6("fe80::1", "fec0::", 9);
   101 		end);
   105 		end);
   102 	end);
   106 	end);
   103 
   107 
   104 	describe("#truncate()", function ()
   108 	describe("#truncate()", function ()
   105 		it("should work for IPv4", function ()
   109 		it("should work for IPv4", function ()