Tarantool development patches archive
 help / color / mirror / Atom feed
From: Kirill Shcherbatov <kshcherbatov@tarantool.org>
To: tarantool-patches@freelists.org, vdavydov.dev@gmail.com
Cc: Kirill Shcherbatov <kshcherbatov@tarantool.org>
Subject: [PATCH v1 1/1] tests: fix flaky hints test
Date: Wed, 27 Mar 2019 17:16:56 +0300	[thread overview]
Message-ID: <0ad1aa7a7046e13b5705cf4c5b8c7a5c6216f23d.1553696115.git.kshcherbatov@tarantool.org> (raw)

We must use long long unsigned numbers on ffi types build to
avoid precision lost.

Follow-up
        f5721edc825b test: check hints corner cases

Closes #4080
---
https://github.com/tarantool/tarantool/issues/4080
https://github.com/tarantool/tarantool/tree/kshch/gh-4080-hints-fixup

 test/engine/hints.result   | 60 ++++++++++++++++++++------------------
 test/engine/hints.test.lua |  4 +--
 2 files changed, 34 insertions(+), 30 deletions(-)

diff --git a/test/engine/hints.result b/test/engine/hints.result
index 946f82039..9841341ce 100644
--- a/test/engine/hints.result
+++ b/test/engine/hints.result
@@ -21,8 +21,8 @@ inspector:cmd("setopt delimiter ';'");
 ...
 function insert_values(type)
         local x = 54
-        while (x <= 64) do
-                local val = ffi.new(type, 2^x-1)
+        while (x < 64) do
+                local val = ffi.new(type, (2LLU^x)-1)
                 s:replace({val})
                 x = x + 1
         end
@@ -46,17 +46,16 @@ insert_values('uint64_t')
 ...
 s:select()
 ---
-- - [0]
-  - [18014398509481984]
-  - [36028797018963968]
-  - [72057594037927936]
-  - [144115188075855872]
-  - [288230376151711744]
-  - [576460752303423488]
-  - [1152921504606846976]
-  - [2305843009213693952]
-  - [4611686018427387904]
-  - [9223372036854775808]
+- - [18014398509481983]
+  - [36028797018963967]
+  - [72057594037927935]
+  - [144115188075855871]
+  - [288230376151711743]
+  - [576460752303423487]
+  - [1152921504606846975]
+  - [2305843009213693951]
+  - [4611686018427387903]
+  - [9223372036854775807]
 ...
 i1:alter{parts = {1, 'integer'}}
 ---
@@ -66,18 +65,16 @@ insert_values('int64_t')
 ...
 s:select()
 ---
-- - [-9223372036854775808]
-  - [0]
-  - [18014398509481984]
-  - [36028797018963968]
-  - [72057594037927936]
-  - [144115188075855872]
-  - [288230376151711744]
-  - [576460752303423488]
-  - [1152921504606846976]
-  - [2305843009213693952]
-  - [4611686018427387904]
-  - [9223372036854775808]
+- - [18014398509481983]
+  - [36028797018963967]
+  - [72057594037927935]
+  - [144115188075855871]
+  - [288230376151711743]
+  - [576460752303423487]
+  - [1152921504606846975]
+  - [2305843009213693951]
+  - [4611686018427387903]
+  - [9223372036854775807]
 ...
 i1:alter{parts = {1, 'number'}}
 ---
@@ -87,19 +84,26 @@ insert_values('double')
 ...
 s:select()
 ---
-- - [-9223372036854775808]
-  - [0]
+- - [18014398509481983]
   - [18014398509481984]
+  - [36028797018963967]
   - [36028797018963968]
+  - [72057594037927935]
   - [72057594037927936]
+  - [144115188075855871]
   - [144115188075855872]
+  - [288230376151711743]
   - [288230376151711744]
+  - [576460752303423487]
   - [576460752303423488]
+  - [1152921504606846975]
   - [1152921504606846976]
+  - [2305843009213693951]
   - [2305843009213693952]
+  - [4611686018427387903]
   - [4611686018427387904]
+  - [9223372036854775807]
   - [9223372036854775808]
-  - [1.844674407371e+19]
 ...
 s:drop()
 ---
diff --git a/test/engine/hints.test.lua b/test/engine/hints.test.lua
index 266516ec9..f081ebed1 100644
--- a/test/engine/hints.test.lua
+++ b/test/engine/hints.test.lua
@@ -12,8 +12,8 @@ engine = inspector:get_cfg('engine')
 inspector:cmd("setopt delimiter ';'");
 function insert_values(type)
         local x = 54
-        while (x <= 64) do
-                local val = ffi.new(type, 2^x-1)
+        while (x < 64) do
+                local val = ffi.new(type, (2LLU^x)-1)
                 s:replace({val})
                 x = x + 1
         end
-- 
2.21.0

             reply	other threads:[~2019-03-27 14:16 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-27 14:16 Kirill Shcherbatov [this message]
2019-03-28  8:43 ` [tarantool-patches] " Kirill Yukhin

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=0ad1aa7a7046e13b5705cf4c5b8c7a5c6216f23d.1553696115.git.kshcherbatov@tarantool.org \
    --to=kshcherbatov@tarantool.org \
    --cc=tarantool-patches@freelists.org \
    --cc=vdavydov.dev@gmail.com \
    --subject='Re: [PATCH v1 1/1] tests: fix flaky hints test' \
    /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