[Tarantool-patches] [PATCH luajit 06/36] test: enable <misc/dualnum.lua> LuaJIT test
Sergey Bronnikov
sergeyb at tarantool.org
Thu Aug 15 16:19:20 MSK 2024
dualnum is an optional LuaJIT feature (LJ_DUALNUM), why we don't have a
separate flag for
the test that will disable test when feature is not available?
On 15.08.2024 16:11, Sergey Bronnikov via Tarantool-patches wrote:
>
> Hi, Sergey
>
> thanks for the patch!
>
> see my comments below
>
> On 14.08.2024 16:55, Sergey Kaplun wrote:
>> This patch moves the aforementioned test from the <misc> to the <lang/>
>> directory, includes it in <index>, and names subtests.
>
> Add a reason for this and couple of words about updated formatting in
> the test.
>
>
>> Part of tarantool/tarantool#9398
>> ---
>> test/LuaJIT-tests/{misc => lang}/dualnum.lua | 24 +++++++++-----------
>> test/LuaJIT-tests/lang/index | 1 +
>> 2 files changed, 12 insertions(+), 13 deletions(-)
>> rename test/LuaJIT-tests/{misc => lang}/dualnum.lua (57%)
>>
>> diff --git a/test/LuaJIT-tests/misc/dualnum.lua b/test/LuaJIT-tests/lang/dualnum.lua
>> similarity index 57%
>> rename from test/LuaJIT-tests/misc/dualnum.lua
>> rename to test/LuaJIT-tests/lang/dualnum.lua
>> index 5f1288c8..688920eb 100644
>> --- a/test/LuaJIT-tests/misc/dualnum.lua
>> +++ b/test/LuaJIT-tests/lang/dualnum.lua
>> @@ -1,34 +1,32 @@
>> +-- Test LuaJIT Dualnum mode behaviour.
>>
>> --- Positive overflow
>> -do
>> +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
>>
>> --- Negative overflow
>> -do
>> +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
>>
>> --- SLOAD with number to integer conversion.
>> -do
>> +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 i = 1, 20 do
>> + for j = a, b, c do end
>> end
>> end
>>
>> -do
>> +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)
>> diff --git a/test/LuaJIT-tests/lang/index b/test/LuaJIT-tests/lang/index
>> index 4d9feafd..b0e7f073 100644
>> --- a/test/LuaJIT-tests/lang/index
>> +++ b/test/LuaJIT-tests/lang/index
>> @@ -6,6 +6,7 @@ catch_wrap.lua
>> compare.lua
>> compare_nan.lua
>> constant
>> +dualnum.lua
>> for.lua
>> length.lua
>> lightud.lua
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.tarantool.org/pipermail/tarantool-patches/attachments/20240815/d5d67561/attachment.htm>
More information about the Tarantool-patches
mailing list