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 7461523D932; Fri, 3 Feb 2023 15:45:57 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 7461523D932 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1675428357; bh=F4fY/93zV7QX1cz8XxuttnOaObJQjrQp4MyZvtGJIqA=; h=To:Cc:Date:Subject:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=PnfG6FcYgoGiAZohwhtyCcuBNaEejSQeuhhwSIya30wcF5JxAySPtiKG18yr+1y4A Si1ImLyiTfv9VPK3RhBXk6ZE4L1iwJHcfJXrDBDkCji2ymYq1ixRnchoXyzndfF/KW UidEB/sXFEbOaxLzDV22mR6Ji5FIUUC3VmmuJBp4= Received: from mail-lj1-f170.google.com (mail-lj1-f170.google.com [209.85.208.170]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id 2B36F23D932 for ; Fri, 3 Feb 2023 15:45:56 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 2B36F23D932 Received: by mail-lj1-f170.google.com with SMTP id h4so5137215lja.2 for ; Fri, 03 Feb 2023 04:45:56 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=5sZk75BnvFUM/fy+rspsHM/sxNO7+2CA5uKPI8NZMlY=; b=V5BJ1domS6QJ/oNXJeszStXdIYnS8DFVaRhm+gYL06qwWNZk9CscypU6T4jKm1NvIR epDGH8KhxOWKuw8CuWXQQ4oo0Rjt+lQkYfxyxlAWJROklQHeby6qe0/XQhvfbWMMDdr5 IwXwcOlf9CL5ExUs43N9DloTU1fNnfaFBi6Qg6AxgkvAmQKvx3GMg/qeJ68lwPiy4i5Z lA7/afLpdnp6EjTtCoevKADvyH0pPRr23IoHQz2de+5MkmJkITIz6bHcTCtn62CGGVed FoFqAURmDG6YRDd6hliOZN7hlwDQycHy8QKt+ETY70J9mnl1k7m3AoqKR5RA6S8GOeFV 9eYw== X-Gm-Message-State: AO0yUKXPGKz4mWLKEi7yEqwbc0fjgo2U9XuGuR9hHyhPXRhwe7GxQ/+7 8eJ7sJIZ43eZvYsVYORVCuKysm5aFjuWsA== X-Google-Smtp-Source: AK7set8DYZTUxjLW7iMqjg+58ZIv1978Kqo7ETmoYoEO8uOfjPjlvgNyiAwNom1J2vtgqXkXsFkzJg== X-Received: by 2002:a2e:86cc:0:b0:290:5177:1ff1 with SMTP id n12-20020a2e86cc000000b0029051771ff1mr2702299ljj.6.1675428355075; Fri, 03 Feb 2023 04:45:55 -0800 (PST) Received: from localhost.localdomain ([93.175.28.32]) by smtp.gmail.com with ESMTPSA id t11-20020a2e9c4b000000b0029087a45bf4sm81790ljj.11.2023.02.03.04.45.54 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Fri, 03 Feb 2023 04:45:54 -0800 (PST) To: tarantool-patches@dev.tarantool.org, sergos@tarantool.org, skaplun@tarantool.org, m.kokryashkin@tarantool.org Cc: Maksim Kokryashkin Date: Fri, 3 Feb 2023 15:45:50 +0300 Message-Id: <20230203124550.47694-1-max.kokryashkin@gmail.com> X-Mailer: git-send-email 2.37.1 (Apple Git-137.1) MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [Tarantool-patches] [PATCH luajit] test: add test case for math.modf 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: Maksim Kokryashkin via Tarantool-patches Reply-To: Maksim Kokryashkin Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" 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 --- 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() + +local modf = math.modf +local inf = math.huge + +local r1 = {nil, nil, nil, nil} +local r2 = {nil, nil, nil, nil} + +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)