Tarantool development patches archive
 help / color / mirror / Atom feed
From: Maxim Kokryashkin via Tarantool-patches <tarantool-patches@dev.tarantool.org>
To: "Igor Munkin" <imun@tarantool.org>
Cc: "Maksim Kokryashkin" <max.kokryashkin@gmail.com>,
	tarantool-patches@dev.tarantool.org
Subject: Re: [Tarantool-patches]  [PATCH luajit] test: add test case for math.modf
Date: Thu, 09 Mar 2023 15:14:33 +0300	[thread overview]
Message-ID: <1678364073.564437180@f726.i.mail.ru> (raw)
In-Reply-To: <ZADDehHDT/WhaINo@tarantool.org>

[-- Attachment #1: Type: text/plain, Size: 2063 bytes --]


Hi!
Thanks for the review!
Fixed your nits, the branch is force pushed.
--
Best regards,
Maxim Kokryashkin
 
 
> 
>>Max,
>>
>>Thanks for the patch! LGTM, but there are some nits below.
>>
>>On 03.02.23, Maksim Kokryashkin via Tarantool-patches wrote:
>>> Follows up commit 9b6c0cd8eafdd2e5a8a7ac4b33f6e33b3d8a93b9
>>> ("Don't compile math.modf() anymore.").
>>>
>>> This patch introduces the test case for the issue with
>>> compiled `math.modf`, that was fixed by disabling the
>>> compilation for it.
>>>
>>> Part of tarantool/tarantool#7230
>>
>>Minor: It follows up the ticket, not a part of it.
>>
>>> ---
>>> Branch:  https://github.com/tarantool/luajit/tree/fckxorg/modf-test
>>> PR:  https://github.com/tarantool/tarantool/pull/8251
>>>
>>> test/tarantool-tests/math-modf.test.lua | 31 +++++++++++++++++++++++++
>>> 1 file changed, 31 insertions(+)
>>> create mode 100644 test/tarantool-tests/math-modf.test.lua
>>>
>>> diff --git a/test/tarantool-tests/math-modf.test.lua b/test/tarantool-tests/math-modf.test.lua
>>> new file mode 100644
>>> index 00000000..2aaa5189
>>> --- /dev/null
>>> +++ b/test/tarantool-tests/math-modf.test.lua
>>> @@ -0,0 +1,31 @@
>>> +local tap = require('tap')
>>> +local test = tap.test('math-modf')
>>> +test:plan(1)
>>> +
>>> +local function isnan(x)
>>> + return x ~= x
>>> +end
>>> +
>>> +local function array_is_consistent(res)
>>> + for i = 1, #res - 1 do
>>> + if res[i] ~= res[i + 1] and not (isnan(res[i]) and isnan(res[i + 1])) then
>>> + return false
>>> + end
>>> + end
>>> + return true
>>> +end
>>> +
>>> +jit.opt.start('hotloop=1')
>>> +jit.on()
>>
>>This line is excess.
>>
>>> +
>>> +local modf = math.modf
>>> +local inf = math.huge
>>> +
>>> +local r1 = {nil, nil, nil, nil}
>>> +local r2 = {nil, nil, nil, nil}
>>
>>Minor: I'd rather use table.new here to make it clearer.
>>
>>> +
>>> +for i = 1, 4 do
>>> + r1[i], r2[i] = modf(inf)
>>> +end
>>> +
>>> +test:ok(array_is_consistent(r1) and array_is_consistent(r2), 'wrong modf')
>>> --
>>> 2.37.1 (Apple Git-137.1)
>>>
>>
>>--
>>Best regards,
>>IM
> 

[-- Attachment #2: Type: text/html, Size: 3004 bytes --]

  reply	other threads:[~2023-03-09 12:14 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-03 12:45 Maksim Kokryashkin via Tarantool-patches
2023-02-03 13:06 ` Sergey Kaplun via Tarantool-patches
2023-03-02 12:31 ` sergos via Tarantool-patches
2023-03-02 15:40 ` Igor Munkin via Tarantool-patches
2023-03-09 12:14   ` Maxim Kokryashkin via Tarantool-patches [this message]
2023-03-30 17:38 ` Igor Munkin via Tarantool-patches

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1678364073.564437180@f726.i.mail.ru \
    --to=tarantool-patches@dev.tarantool.org \
    --cc=imun@tarantool.org \
    --cc=m.kokryashkin@tarantool.org \
    --cc=max.kokryashkin@gmail.com \
    --subject='Re: [Tarantool-patches]  [PATCH luajit] test: add test case for math.modf' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox