From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from [87.239.111.99] (localhost [127.0.0.1]) by dev.tarantool.org (Postfix) with ESMTP id 432536B963; Tue, 13 Apr 2021 16:37:35 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 432536B963 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1618321055; bh=bxvIErC+F/pVUUwpZdt/6C4H59t9UTefvHnw8vgiciE=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=QyNbcYWiINiBhgDoBKf5QMl0Tta3/hMOfzE7ZXmun/lxh4cM8f3oIXUlpE+NABzSO ALqjiGNZATtulpxqFyR5Owalp0ogvTxVUZ3W8yd4KGXHx7dej3NMDyH3NyJaFgniyy 1K0rZteTvXb5qJ+5Tn4Bqyv5QYg0qszrdHMcseRw= Received: from smtp48.i.mail.ru (smtp48.i.mail.ru [94.100.177.108]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id C013C6B963 for ; Tue, 13 Apr 2021 16:28:53 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org C013C6B963 Received: by smtp48.i.mail.ru with esmtpa (envelope-from ) id 1lWJ64-0000dj-JK; Tue, 13 Apr 2021 16:28:53 +0300 To: Sergey Ostanevich , Igor Munkin Date: Tue, 13 Apr 2021 16:27:18 +0300 Message-Id: X-Mailer: git-send-email 2.31.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-7564579A: 646B95376F6C166E X-77F55803: 4F1203BC0FB41BD92FFCB8E6708E7480B1C8842CE613979723F2FB4628545A35182A05F5380850406A1C7D1BED17FEA83E1CDE5A392D297CB836584D21FD2619463AA9AF4D645A7D X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE7A4C4638C9DDF45FCEA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F79006377A2EA98384B91C6C8638F802B75D45FF914D58D5BE9E6BC1A93B80C6DEB9DEE97C6FB206A91F05B278079A7F61565132640936C7DCDF19A0088CACE0DB6A842FD2E47CDBA5A96583C09775C1D3CA48CF90D92131081DE748117882F4460429724CE54428C33FAD30A8DF7F3B2552694AC26CFBAC0749D213D2E47CDBA5A9658378DA827A17800CE77E7E81EEA8A9722B8941B15DA834481F9449624AB7ADAF372E808ACE2090B5E1725E5C173C3A84C3C5EA940A35A165FF2DBA43225CD8A89FDD013041C98CC2AB57739F23D657EF2BB5C8C57E37DE458BEDA766A37F9254B7 X-C1DE0DAB: C20DE7B7AB408E4181F030C43753B8186998911F362727C414F749A5E30D975CB69F9342289A40B384FCF1CCB6C8A1816381042E52779D689C2B6934AE262D3EE7EAB7254005DCED7532B743992DF240BDC6A1CF3F042BAD6DF99611D93F60EF0417BEADF48D1460699F904B3F4130E343918A1A30D5E7FCCB5012B2E24CD356 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D34E69981C39E7B068A2DAFC4D9225F6B03BB4CE86AF4B58B1A8C7B07273B81ABD889F37875F6D838EC1D7E09C32AA3244C59050FF62808FFED70A3E7AA0E5B369455E75C8D0ED9F6EE927AC6DF5659F194 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojnA7/qPBUIXGVxmTQ1f5uTQ== X-Mailru-Sender: 3B9A0136629DC91206CBC582EFEF4CB468224445D982F2250CB0C4669B49AB2C9D8EA9046FAED6CAF2400F607609286E924004A7DEC283833C7120B22964430C52B393F8C72A41A89437F6177E88F7363CDA0F3B3F5B9367 X-Mras: Ok Subject: [Tarantool-patches] [PATCH luajit v3 18/29] test: use math.fmod in PUC-Rio tests X-BeenThere: tarantool-patches@dev.tarantool.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Sergey Kaplun via Tarantool-patches Reply-To: Sergey Kaplun Cc: tarantool-patches@dev.tarantool.org Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" 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