Tarantool development patches archive
 help / color / mirror / Atom feed
* [PATCH v1 1/1] tests: fix flaky hints test
@ 2019-03-27 14:16 Kirill Shcherbatov
  2019-03-28  8:43 ` [tarantool-patches] " Kirill Yukhin
  0 siblings, 1 reply; 2+ messages in thread
From: Kirill Shcherbatov @ 2019-03-27 14:16 UTC (permalink / raw)
  To: tarantool-patches, vdavydov.dev; +Cc: Kirill Shcherbatov

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [tarantool-patches] [PATCH v1 1/1] tests: fix flaky hints test
  2019-03-27 14:16 [PATCH v1 1/1] tests: fix flaky hints test Kirill Shcherbatov
@ 2019-03-28  8:43 ` Kirill Yukhin
  0 siblings, 0 replies; 2+ messages in thread
From: Kirill Yukhin @ 2019-03-28  8:43 UTC (permalink / raw)
  To: tarantool-patches; +Cc: vdavydov.dev, Kirill Shcherbatov

Hello,

On 27 Mar 17:16, Kirill Shcherbatov wrote:
> 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

I've checked your patch into master.

--
Regards, Kirill Yukhin

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-03-28  8:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-27 14:16 [PATCH v1 1/1] tests: fix flaky hints test Kirill Shcherbatov
2019-03-28  8:43 ` [tarantool-patches] " Kirill Yukhin

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