Tarantool development patches archive
 help / color / mirror / Atom feed
From: Sergey Kaplun via Tarantool-patches <tarantool-patches@dev.tarantool.org>
To: Sergey Ostanevich <sergos@tarantool.org>,
	Igor Munkin <imun@tarantool.org>
Cc: tarantool-patches@dev.tarantool.org
Subject: [Tarantool-patches] [PATCH luajit v3 18/29] test: use math.fmod in PUC-Rio tests
Date: Tue, 13 Apr 2021 16:27:18 +0300	[thread overview]
Message-ID: <fa64c2a1936486cdd651717498d22184778a8e24.1618320000.git.skaplun@tarantool.org> (raw)
In-Reply-To: <cover.1618320000.git.skaplun@tarantool.org>

In Lua 5.1 math.mod() is renamed to math.fmod() if one builds Lua 5.1
without `-DLUA_COMPAT_MOD` flag.
LuaJIT has math.fmod() instead of old-style math.mod() built-in.
This backward compatibility was dropped via commit
de5568e0eaf22d2c7d58c2cbd9060460abc4ff2f
(Remove Lua 5.0 compatibility defines.).

This patch replaces usage of math.mod with new-style math.fmod
in the following files:
* closure.lua
* constructs.lua
* math.lua
* nextvar.lua

Resolves tarantool/tarantool#5711
Part of tarantool/tarantool#5845
Part of tarantool/tarantool#4473
---
 test/PUC-Rio-Lua-5.1-tests/closure.lua    | 4 +++-
 test/PUC-Rio-Lua-5.1-tests/constructs.lua | 6 ++++--
 test/PUC-Rio-Lua-5.1-tests/math.lua       | 3 ++-
 test/PUC-Rio-Lua-5.1-tests/nextvar.lua    | 3 ++-
 4 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/test/PUC-Rio-Lua-5.1-tests/closure.lua b/test/PUC-Rio-Lua-5.1-tests/closure.lua
index 27ca0adf..fdcfe934 100644
--- a/test/PUC-Rio-Lua-5.1-tests/closure.lua
+++ b/test/PUC-Rio-Lua-5.1-tests/closure.lua
@@ -254,7 +254,9 @@ function filter (p, g)
     while 1 do
       local n = g()
       if n == nil then return end
-      if math.mod(n, p) ~= 0 then coroutine.yield(n) end
+      -- LuaJIT: use `math.fmod()` instead of old-style
+      -- `math.mod()`.
+      if math.fmod(n, p) ~= 0 then coroutine.yield(n) end
     end
   end)
 end
diff --git a/test/PUC-Rio-Lua-5.1-tests/constructs.lua b/test/PUC-Rio-Lua-5.1-tests/constructs.lua
index 5fb37986..970b8c4b 100644
--- a/test/PUC-Rio-Lua-5.1-tests/constructs.lua
+++ b/test/PUC-Rio-Lua-5.1-tests/constructs.lua
@@ -202,7 +202,8 @@ function ID(x) return x end
 
 function f(t, i)
   local b = t.n
-  local res = math.mod(math.floor(i/c), b)+1
+  -- LuaJIT: use `math.fmod()` instead of old-style `math.mod()`.
+  local res = math.fmod(math.floor(i/c), b)+1
   c = c*b
   return t[res]
 end
@@ -233,7 +234,8 @@ repeat
   ]], s1, s, s1, s, s1, s, s1, s, s)
   assert(loadstring(s))()
   assert(X and not NX and not WX1 == K and not WX2 == K)
-  if math.mod(i,4000) == 0 then print('+') end
+  -- LuaJIT: use `math.fmod()` instead of old-style `math.mod()`.
+  if math.fmod(i,4000) == 0 then print('+') end
   i = i+1
 until i==c
 
diff --git a/test/PUC-Rio-Lua-5.1-tests/math.lua b/test/PUC-Rio-Lua-5.1-tests/math.lua
index 5076f38d..f66ce196 100644
--- a/test/PUC-Rio-Lua-5.1-tests/math.lua
+++ b/test/PUC-Rio-Lua-5.1-tests/math.lua
@@ -100,7 +100,8 @@ assert(math.abs(-10) == 10)
 assert(eq(math.atan2(1,0), math.pi/2))
 assert(math.ceil(4.5) == 5.0)
 assert(math.floor(4.5) == 4.0)
-assert(math.mod(10,3) == 1)
+-- LuaJIT: use `math.fmod()` instead of old-style `math.mod()`.
+assert(math.fmod(10,3) == 1)
 assert(eq(math.sqrt(10)^2, 10))
 assert(eq(math.log10(2), math.log(2)/math.log(10)))
 assert(eq(math.exp(0), 1))
diff --git a/test/PUC-Rio-Lua-5.1-tests/nextvar.lua b/test/PUC-Rio-Lua-5.1-tests/nextvar.lua
index 7ceaa75a..c16bb53a 100644
--- a/test/PUC-Rio-Lua-5.1-tests/nextvar.lua
+++ b/test/PUC-Rio-Lua-5.1-tests/nextvar.lua
@@ -201,7 +201,8 @@ print('+')
 
 a = {}
 for i=0,10000 do
-  if math.mod(i,10) ~= 0 then
+  -- LuaJIT: use `math.fmod()` instead of old-style `math.mod()`.
+  if math.fmod(i,10) ~= 0 then
     a['x'..i] = i
   end
 end
-- 
2.31.0


  parent reply	other threads:[~2021-04-13 13:37 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-13 13:27 [Tarantool-patches] [PATCH luajit v3 00/29] Adapt PUC-Rio Lua 5.1 test suite Sergey Kaplun via Tarantool-patches
2021-04-13 13:27 ` [Tarantool-patches] [PATCH luajit v3 01/29] test: add " Sergey Kaplun via Tarantool-patches
2021-04-13 20:31   ` Igor Munkin via Tarantool-patches
2021-04-14 13:54     ` Sergey Kaplun via Tarantool-patches
2021-04-13 13:27 ` [Tarantool-patches] [PATCH luajit v3 02/29] test: build auxiliary C libs from PUC-Rio Lua 5.1 Sergey Kaplun via Tarantool-patches
2021-04-13 13:27 ` [Tarantool-patches] [PATCH luajit v3 03/29] test: adapt PUC-Rio suite for out-of-source build Sergey Kaplun via Tarantool-patches
2021-04-13 21:05   ` Igor Munkin via Tarantool-patches
2021-04-14 13:54     ` Sergey Kaplun via Tarantool-patches
2021-04-13 13:27 ` [Tarantool-patches] [PATCH luajit v3 04/29] test: remove quotes in progname from PUC-Rio Sergey Kaplun via Tarantool-patches
2021-04-13 13:27 ` [Tarantool-patches] [PATCH luajit v3 05/29] test: adapt PUC-Rio test for arg presence Sergey Kaplun via Tarantool-patches
2021-04-13 13:27 ` [Tarantool-patches] [PATCH luajit v3 06/29] test: disable PUC-Rio tests confused by -v output Sergey Kaplun via Tarantool-patches
2021-04-13 13:27 ` [Tarantool-patches] [PATCH luajit v3 07/29] test: disable PUC-Rio tests for bytecode header Sergey Kaplun via Tarantool-patches
2021-04-13 13:27 ` [Tarantool-patches] [PATCH luajit v3 08/29] test: adapt PUC-Rio tests counting GC steps Sergey Kaplun via Tarantool-patches
2021-04-13 13:27 ` [Tarantool-patches] [PATCH luajit v3 09/29] test: disable PUC-Rio suite tests for line hook Sergey Kaplun via Tarantool-patches
2021-04-13 13:27 ` [Tarantool-patches] [PATCH luajit v3 10/29] test: adapt PUC-Rio tests with vararg functions Sergey Kaplun via Tarantool-patches
2021-04-13 13:27 ` [Tarantool-patches] [PATCH luajit v3 11/29] test: adapt PUC-Rio test for debug in vararg func Sergey Kaplun via Tarantool-patches
2021-04-13 13:27 ` [Tarantool-patches] [PATCH luajit v3 12/29] test: adapt PUC-Rio test with count hooks Sergey Kaplun via Tarantool-patches
2021-04-13 13:27 ` [Tarantool-patches] [PATCH luajit v3 13/29] test: disable PUC-Rio test for tail call info Sergey Kaplun via Tarantool-patches
2021-04-13 13:27 ` [Tarantool-patches] [PATCH luajit v3 14/29] test: adapt PUC-Rio test with activeline check Sergey Kaplun via Tarantool-patches
2021-04-13 13:27 ` [Tarantool-patches] [PATCH luajit v3 15/29] test: disable PUC-Rio test for per-coroutine hooks Sergey Kaplun via Tarantool-patches
2021-04-13 13:27 ` [Tarantool-patches] [PATCH luajit v3 16/29] test: adapt PUC-Rio test for %q in string.format Sergey Kaplun via Tarantool-patches
2021-04-13 13:27 ` [Tarantool-patches] [PATCH luajit v3 17/29] test: disable locale-dependent PUC-Rio tests Sergey Kaplun via Tarantool-patches
2021-04-13 13:27 ` Sergey Kaplun via Tarantool-patches [this message]
2021-04-13 13:27 ` [Tarantool-patches] [PATCH luajit v3 19/29] test: remove string.gfind assert in PUC-Rio test Sergey Kaplun via Tarantool-patches
2021-04-13 13:27 ` [Tarantool-patches] [PATCH luajit v3 20/29] test: disable PUC-Rio test for getfenv in tailcall Sergey Kaplun via Tarantool-patches
2021-04-13 13:27 ` [Tarantool-patches] [PATCH luajit v3 21/29] test: disable PUC-Rio test for variables in error Sergey Kaplun via Tarantool-patches
2021-04-13 13:27 ` [Tarantool-patches] [PATCH luajit v3 22/29] test: disable PUC-Rio test for fast function name Sergey Kaplun via Tarantool-patches
2021-04-13 13:27 ` [Tarantool-patches] [PATCH luajit v3 23/29] test: disable PUC-Rio test for non-asci identifier Sergey Kaplun via Tarantool-patches
2021-04-13 13:27 ` [Tarantool-patches] [PATCH luajit v3 24/29] test: disable PUC-Rio test for syntax level error Sergey Kaplun via Tarantool-patches
2021-04-13 13:27 ` [Tarantool-patches] [PATCH luajit v3 25/29] test: disable PUC-RIO tests for several -l options Sergey Kaplun via Tarantool-patches
2021-04-13 13:27 ` [Tarantool-patches] [PATCH luajit v3 26/29] test: disable PUC-Rio test for checking arg layout Sergey Kaplun via Tarantool-patches
2021-04-13 13:27 ` [Tarantool-patches] [PATCH luajit v3 27/29] test: disable PUC-Rio test checking -h option Sergey Kaplun via Tarantool-patches
2021-04-13 13:27 ` [Tarantool-patches] [PATCH luajit v3 28/29] test: disable PUC-Rio hanging GC test Sergey Kaplun via Tarantool-patches
2021-04-13 13:27 ` [Tarantool-patches] [PATCH luajit v3 29/29] test: disable too deep recursive PUC-Rio test Sergey Kaplun via Tarantool-patches
2021-04-14 21:08 ` [Tarantool-patches] [PATCH luajit v3 00/29] Adapt PUC-Rio Lua 5.1 test suite 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=fa64c2a1936486cdd651717498d22184778a8e24.1618320000.git.skaplun@tarantool.org \
    --to=tarantool-patches@dev.tarantool.org \
    --cc=imun@tarantool.org \
    --cc=sergos@tarantool.org \
    --cc=skaplun@tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH luajit v3 18/29] test: use math.fmod in PUC-Rio tests' \
    /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