Implement lb_tcpstream
This commit is contained in:
@@ -1,6 +1,27 @@
|
||||
local ok, net = pcall(require, "lb:net")
|
||||
if not ok then return end
|
||||
|
||||
describe("ipaddr", function()
|
||||
test("invalid ipaddr throws", function()
|
||||
assert(not pcall(net.ipaddr, "invalid ip"))
|
||||
end)
|
||||
|
||||
test("comparison", function()
|
||||
local a = net.ipaddr("10.0.0.1")
|
||||
local b = net.ipaddr("10.0.0.1")
|
||||
local c = net.ipaddr("10.0.0.2")
|
||||
assert(a ~= nil and a ~= {} and a ~= "10.0.0.1" and a ~= 167772161)
|
||||
assert(a == a and a == b and a ~= c and b ~= c and c == c and c ~= a)
|
||||
assert(a <= b and a < c and a <= c and b < c and b <= c and a <= a and c <= c)
|
||||
assert(not (a < b or a > b or a > c or b > c or a >= c or b >= c))
|
||||
end)
|
||||
|
||||
test("tostring", function()
|
||||
local ip = net.ipaddr("10.0.0.1")
|
||||
assert(tostring(ip) == "10.0.0.1")
|
||||
end)
|
||||
end)
|
||||
|
||||
describe("tcp", function()
|
||||
describe("socket", function()
|
||||
test("bind", function()
|
||||
|
||||
Reference in New Issue
Block a user