[Tarantool-patches] [PATCH v2 luajit 09/45] test: refactor <lang/dualnum.lua> LuaJIT test

Sergey Bronnikov sergeyb at tarantool.org
Thu Aug 22 18:05:27 MSK 2024


Sergey,

On 21.08.2024 11:58, Sergey Kaplun wrote:
> This patch refactors the aforementioned test to make its code style
> closer to ours.
>
> Relates to tarantool/tarantool#9398
> ---
thanks for the patch! LGTM
>   test/LuaJIT-tests/lang/dualnum.lua | 12 ++++++------
>   1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/test/LuaJIT-tests/lang/dualnum.lua b/test/LuaJIT-tests/lang/dualnum.lua
> index d0b1e5d2..bc52b742 100644
> --- a/test/LuaJIT-tests/lang/dualnum.lua
> +++ b/test/LuaJIT-tests/lang/dualnum.lua
> @@ -2,31 +2,31 @@
>   
>   do --- Positive overflow.
>     local x = 0
> -  for i=2147483446,2147483647,2 do x = x + 1 end
> +  for _ = 2147483446, 2147483647, 2 do x = x + 1 end
>     assert(x == 101)
>   end
>   
>   do --- Negative overflow.
>     local x = 0
> -  for i=-2147483447,-2147483648,-2 do x = x + 1 end
> +  for _ = -2147483447, -2147483648, -2 do x = x + 1 end
>     assert(x == 101)
>   end
>   
>   do --- SLOAD with number to integer conversion.
>     local k = 1
>     local a, b, c = 1/k, 20/k, 1/k
> -  for i=1,20 do
> -    for j=a,b,c do end
> +  for _ = 1, 20 do
> +    for _ = a, b, c do end
>     end
>   end
>   
>   do --- min/max correctness.
>     local function fmin(a, b)
> -    for i=1,100 do a = math.min(a, b) end
> +    for _ = 1, 100 do a = math.min(a, b) end
>       return a
>     end
>     local function fmax(a, b)
> -    for i=1,100 do a = math.max(a, b) end
> +    for _ = 1, 100 do a = math.max(a, b) end
>       return a
>     end
>     assert(fmin(1, 3) == 1)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.tarantool.org/pipermail/tarantool-patches/attachments/20240822/275c36f9/attachment.htm>


More information about the Tarantool-patches mailing list