1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-06 04:31:29 +00:00

Adjust unittest definitions to generate proper nsedoc

This commit is contained in:
dmiller
2014-01-04 03:48:13 +00:00
parent c70a7be88f
commit 3570ca78d8

View File

@@ -149,88 +149,79 @@ end
--- Test for nil --- Test for nil
-- @param value The value to test -- @param value The value to test
-- @return bool True if the value is nil, false otherwise. -- @return bool True if the value is nil, false otherwise.
is_nil = make_test( function(value) is_nil = function(value)
return value == nil return value == nil
end, end
"Expected not nil, got %s" is_nil = make_test(is_nil, "Expected not nil, got %s")
)
--- Test for not nil --- Test for not nil
-- @param value The value to test -- @param value The value to test
-- @return bool True if the value is not nil, false otherwise. -- @return bool True if the value is not nil, false otherwise.
not_nil = make_test( function(value) not_nil = function(value)
return value ~= nil return value ~= nil
end, end
"Expected not nil, got %s" not_nil = make_test(not_nil, "Expected not nil, got %s")
)
--- Test for equality --- Test for equality
-- @param a The first value to test -- @param a The first value to test
-- @param b The second value to test -- @param b The second value to test
-- @return bool True if a == b, false otherwise. -- @return bool True if a == b, false otherwise.
equal = make_test( function(a, b) equal = function(a, b)
return a == b return a == b
end, end
"%s not equal to %s" equal = make_test(equal, "%s not equal to %s")
)
--- Test for inequality --- Test for inequality
-- @param a The first value to test -- @param a The first value to test
-- @param b The second value to test -- @param b The second value to test
-- @return bool True if a != b, false otherwise. -- @return bool True if a != b, false otherwise.
not_equal = make_test( function(a, b) not_equal = function(a, b)
return a ~= b return a ~= b
end, end
"%s unexpectedly equal to %s" not_equal = make_test(not_equal, "%s unexpectedly equal to %s")
)
--- Test for truth --- Test for truth
-- @param value The value to test -- @param value The value to test
-- @return bool True if value is a boolean and true -- @return bool True if value is a boolean and true
is_true = make_test( function(value) is_true = function(value)
return value == true return value == true
end, end
"Expected true, got %s" is_true = make_test(is_true, "Expected true, got %s")
)
--- Test for falsehood --- Test for falsehood
-- @param value The value to test -- @param value The value to test
-- @return bool True if value is a boolean and false -- @return bool True if value is a boolean and false
is_false = make_test( function(value) is_false = function(value)
return value == false return value == false
end, end
"Expected false, got %s" is_false = make_test(is_false, "Expected false, got %s")
)
--- Test less than --- Test less than
-- @param a The first value to test -- @param a The first value to test
-- @param b The second value to test -- @param b The second value to test
-- @return bool True if a < b, false otherwise. -- @return bool True if a < b, false otherwise.
lt = make_test( function(a, b) lt = function(a, b)
return a < b return a < b
end, end
"%s not less than %s" lt = make_test(lt, "%s not less than %s")
)
--- Test less than or equal to --- Test less than or equal to
-- @param a The first value to test -- @param a The first value to test
-- @param b The second value to test -- @param b The second value to test
-- @return bool True if a <= b, false otherwise. -- @return bool True if a <= b, false otherwise.
lte = make_test( function(a, b) lte = function(a, b)
return a <= b return a <= b
end, end
"%s not less than %s" lte = make_test(lte, "%s not less than %s")
)
--- Test length --- Test length
-- @param t The table to test -- @param t The table to test
-- @param l The length to test -- @param l The length to test
-- @return bool True if the length of t is l -- @return bool True if the length of t is l
length_is = make_test( function(t, l) length_is = function(t, l)
return #t == l return #t == l
end, end
"Length of %s is not %s" length_is = make_test(length_is, "Length of %s is not %s")
)
--- Expected failure test --- Expected failure test
-- @param test The test to run -- @param test The test to run