File: iterator_lt_gt.result

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 (93 lines) | stat: -rw-r--r-- 1,511 bytes parent folder | download | duplicates (4)
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
-- test for https://github.com/tarantool/tarantool/issues/769
env = require('test_run')
---
...
test_run = env.new()
---
...
s = box.schema.create_space('test')
---
...
i = s:create_index('primary', { type = 'TREE', parts = {1, 'unsigned', 2, 'unsigned'} })
---
...
s:insert{0, 0} s:insert{2, 0}
---
...
for i=1,10000 do s:insert{1, i} end
---
...
test_itrs = {'EQ', 'REQ', 'GT', 'LT', 'GE', 'LE'}
---
...
test_res = {}
---
...
too_longs = {}
---
...
test_run:cmd("setopt delimiter ';'")
---
- true
...
function test_run_itr(itr, key)
    for i=1,50 do
        local gen, param, state = s.index.primary:pairs({key}, {iterator = itr})
        local state, v =  gen(param, state)
        test_res[itr .. ' ' .. key] = v
    end
end;
---
...
jit.off(test_run_itr);
---
...
for _,itr in pairs(test_itrs) do
    local t = os.clock()
    for key = 0,2 do
        test_run_itr(itr, key)
    end
    local diff = os.clock() - t
    if  diff > 0.05 then
        table.insert(too_longs, 'Some of the iterators takes too long to position: '.. diff)
    end
end;
---
...
test_run:cmd("setopt delimiter ''");
---
- true
...
test_res
---
- LE 1: [1, 10000]
  LT 2: [1, 10000]
  REQ 1: [1, 10000]
  EQ 2: [2, 0]
  LE 2: [2, 0]
  EQ 0: [0, 0]
  LT 1: [0, 0]
  GE 0: [0, 0]
  REQ 0: [0, 0]
  GT 0: [1, 1]
  GT 1: [2, 0]
  LE 0: [0, 0]
  REQ 2: [2, 0]
  EQ 1: [1, 1]
  GE 1: [1, 1]
  GE 2: [2, 0]
...
too_longs
---
- []
...
s:drop()
---
...
test_itr = nil test_run_itr = nil test_itrs = nil s = nil
---
...
'done'
---
- done
...