File: gh-4672-min-integer-value-in-serializer.test.lua

package info (click to toggle)
tarantool 2.6.0-1.4
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 85,412 kB
  • sloc: ansic: 513,775; cpp: 69,493; sh: 25,650; python: 19,190; perl: 14,973; makefile: 4,178; yacc: 1,329; sql: 1,074; pascal: 620; ruby: 190; awk: 18; lisp: 7
file content (36 lines) | stat: -rw-r--r-- 1,059 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
remote = require('net.box')
env = require('test_run')
test_run = env.new()

--
-- gh-4672: Due to an error in the serializer, -2^63 was
-- serialized as double, although in accordance with the rules of
-- serialization it should be serialized as an integer.
--
format={{name='u', type='unsigned'}, {name='i', type='integer'}}
s = box.schema.space.create('serializer_test_space', {format=format})
_ = s:create_index('ii')

s:insert({1, -2^63})
s:insert({2, -9223372036854775808LL})
s:insert({3, 0})
s:update(3, {{'=', 2, -2^63}})
s:insert({4, 0})
s:update(4, {{'=', 2, -9223372036854775808LL}})

box.schema.user.grant('guest', 'read, write', 'space', 'serializer_test_space')

cn = remote.connect(box.cfg.listen)
s = cn.space.serializer_test_space

s:insert({11, -2^63})
s:insert({12, -9223372036854775808LL})
s:insert({13, 0})
s:update(13, {{'=', 2, -2^63}})
s:insert({14, 0})
s:update(14, {{'=', 2, -9223372036854775808LL}})

cn:close()
box.schema.user.revoke('guest', 'read, write', 'space', 'serializer_test_space')

box.space.serializer_test_space:drop()