diff options
| author | Alexey Melnichuk <alexeymelnichuck@gmail.com> | 2016-09-05 16:21:12 +0300 |
|---|---|---|
| committer | Alexey Melnichuk <alexeymelnichuck@gmail.com> | 2016-09-05 16:21:12 +0300 |
| commit | 6ed85312ce7f923dfb936000ea87f91d366cc49b (patch) | |
| tree | 7aa277d6d4aed86b19a2292727d7d7b85b4106d8 | |
| parent | 75a319a5e7d251bc18994fad56749017f8fac993 (diff) | |
| download | lua-llthreads2-6ed85312ce7f923dfb936000ea87f91d366cc49b.tar.gz lua-llthreads2-6ed85312ce7f923dfb936000ea87f91d366cc49b.tar.bz2 lua-llthreads2-6ed85312ce7f923dfb936000ea87f91d366cc49b.zip | |
Add. Test to pass lua_Integer as argument
| -rw-r--r-- | test/test_integer.lua | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/test/test_integer.lua b/test/test_integer.lua new file mode 100644 index 0000000..b149fd9 --- /dev/null +++ b/test/test_integer.lua | |||
| @@ -0,0 +1,25 @@ | |||
| 1 | -- only since Lua 5.3 | ||
| 2 | if math.type then | ||
| 3 | |||
| 4 | local thread_code = function(...) | ||
| 5 | local function assert_equal(name, a, b, ...) | ||
| 6 | if a == b then return b, ... end | ||
| 7 | print(name .. " Fail! Expected `" .. tostring(a) .. "` got `" .. tostring(b) .. "`") | ||
| 8 | os.exit(1) | ||
| 9 | end | ||
| 10 | |||
| 11 | local a,b = ... | ||
| 12 | assert_equal("1:", 'integer', math.type(a)) | ||
| 13 | assert_equal("2:", 'float', math.type(b)) | ||
| 14 | end | ||
| 15 | |||
| 16 | local llthreads = require"llthreads.ex" | ||
| 17 | |||
| 18 | local thread = llthreads.new(thread_code, 10, 20.0 ) | ||
| 19 | |||
| 20 | assert(thread:start()) | ||
| 21 | |||
| 22 | assert(thread:join()) | ||
| 23 | end | ||
| 24 | |||
| 25 | print("done!") \ No newline at end of file | ||
