[Tarantool-patches] [PATCH v2 luajit 15/26] test: enable <ffi_lex_number.lua> in LuaJIT-tests

Maxim Kokryashkin m.kokryashkin at tarantool.org
Thu Feb 1 11:38:28 MSK 2024


Hi, Sergey!
Thanks for the patch!
Please consider two comments below.

On Mon, Jan 29, 2024 at 01:45:15PM +0300, Sergey Kaplun wrote:
> This patch changes the `dofile()` (which uses an unreliable relative
> file path and mutates `_G` with global functions to be defined) to the
> corresponding `require()`. Also, it adds groups with the names of
> subtests and enables the test in <index>.
>
> Part of tarantool/tarantool#9398
> ---
>  test/LuaJIT-tests/lib/ffi/ffi_lex_number.lua | 72 +++++++++++---------
>  test/LuaJIT-tests/lib/ffi/index              |  1 +
>  2 files changed, 39 insertions(+), 34 deletions(-)
>
> diff --git a/test/LuaJIT-tests/lib/ffi/ffi_lex_number.lua b/test/LuaJIT-tests/lib/ffi/ffi_lex_number.lua
> index e26650ef..ca6c65c5 100644
> --- a/test/LuaJIT-tests/lib/ffi/ffi_lex_number.lua
> +++ b/test/LuaJIT-tests/lib/ffi/ffi_lex_number.lua
> @@ -1,6 +1,6 @@
>  local ffi = require("ffi")
>
> -dofile("../common/ffi_util.inc")
> +local checkfail = require("common.ffi.checkfail")
>
>  local function checklex(t)
>    for i=1,1e9,2 do
> @@ -14,38 +14,42 @@ local function checklex(t)
>    end
>  end
>
> -checklex{
> -  "0LL",			"0ll",
> -  "0LL",			"0LL",
> -  "0ULL",			"0ull",
> -  "0ULL",			"0ULl",
> -  "18446744073709551615ULL",	"18446744073709551615llu",
> -  "9223372036854775807LL",	"0x7fffffffffffffffll",
> -  "9223372036854775808ULL",	"0x8000000000000000ull",
> -  "1311768467463790320LL",	"0x123456789abcdef0ll",
> -  "-1LL",			"-1ll",
> -  "18446744073709551615ULL",	"-1ull",
> -  "-9223372036854775807LL",	"-0x7fffffffffffffffll",
> -  "9223372036854775808ULL",	"-0x8000000000000000ull",
> -  "0+0i",			"0i",
> -  "0+0i",			"0I",
> -  "0+12.5i",			"12.5i",
> -  "0+4660i",			"0x1234i",
> -  "0+infI",			"1e400i",
> -  "0-infI",			"-1e400i",
> -  "0-12.5i",			"-12.5i",
> -  "0-0i",			"-0i",
> -}
> +do --- checklex
Maybe we can come up with a more elaborate name?
> +  checklex{
> +    "0LL",			"0ll",
> +    "0LL",			"0LL",
> +    "0ULL",			"0ull",
> +    "0ULL",			"0ULl",
> +    "18446744073709551615ULL",	"18446744073709551615llu",
> +    "9223372036854775807LL",	"0x7fffffffffffffffll",
> +    "9223372036854775808ULL",	"0x8000000000000000ull",
> +    "1311768467463790320LL",	"0x123456789abcdef0ll",
> +    "-1LL",			"-1ll",
> +    "18446744073709551615ULL",	"-1ull",
> +    "-9223372036854775807LL",	"-0x7fffffffffffffffll",
> +    "9223372036854775808ULL",	"-0x8000000000000000ull",
> +    "0+0i",			"0i",
> +    "0+0i",			"0I",
> +    "0+12.5i",			"12.5i",
> +    "0+4660i",			"0x1234i",
> +    "0+infI",			"1e400i",
> +    "0-infI",			"-1e400i",
> +    "0-12.5i",			"-12.5i",
> +    "0-0i",			"-0i",
> +  }
> +end
>
> -checkfail({
> -  "0l",
> -  "0lll",
> -  "0u",
> -  "0ul",
> -  "0ulll",
> -  "0wll",
> -  "0xll",
> -  ".0ll",
> -  "0ii",
> -}, function(s) assert(loadstring("return "..s)) end)
> +do --- checkfail
Same here.
> +  checkfail({
> +    "0l",
> +    "0lll",
> +    "0u",
> +    "0ul",
> +    "0ulll",
> +    "0wll",
> +    "0xll",
> +    ".0ll",
> +    "0ii",
> +  }, function(s) assert(loadstring("return "..s)) end)
> +end
>
> diff --git a/test/LuaJIT-tests/lib/ffi/index b/test/LuaJIT-tests/lib/ffi/index
> index 71def57b..833c31e3 100644
> --- a/test/LuaJIT-tests/lib/ffi/index
> +++ b/test/LuaJIT-tests/lib/ffi/index
> @@ -13,6 +13,7 @@ ffi_gcstep_recursive.lua
>  ffi_jit_arith.lua
>  ffi_jit_call.lua
>  ffi_jit_conv.lua
> +ffi_lex_number.lua
>  istype.lua
>  jit_array.lua
>  jit_complex.lua
> --
> 2.43.0
>


More information about the Tarantool-patches mailing list