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 94
|
-- test-run result file version 2
-------------------------------------------------------------------------------
-- 64-bit hash insert fields tests
-------------------------------------------------------------------------------
hash = box.schema.space.create('tweedledum')
| ---
| ...
tmp = hash:create_index('primary', { type = 'hash', parts = {1, 'unsigned'}, unique = true })
| ---
| ...
-- Insert valid fields
hash:insert{0ULL, 'value1 v1.0', 'value2 v1.0'}
| ---
| - [0, 'value1 v1.0', 'value2 v1.0']
| ...
hash:insert{1ULL, 'value1 v1.0', 'value2 v1.0'}
| ---
| - [1, 'value1 v1.0', 'value2 v1.0']
| ...
hash:insert{2ULL, 'value1 v1.0', 'value2 v1.0'}
| ---
| - [2, 'value1 v1.0', 'value2 v1.0']
| ...
hash:insert{3ULL, 'value1 v1.0', 'value2 v1.0'}
| ---
| - [3, 'value1 v1.0', 'value2 v1.0']
| ...
-------------------------------------------------------------------------------
-- 64-bit hash select fields test
-------------------------------------------------------------------------------
-- select by valid keys
hash.index['primary']:get{0ULL}
| ---
| - [0, 'value1 v1.0', 'value2 v1.0']
| ...
hash.index['primary']:get{1ULL}
| ---
| - [1, 'value1 v1.0', 'value2 v1.0']
| ...
hash.index['primary']:get{2ULL}
| ---
| - [2, 'value1 v1.0', 'value2 v1.0']
| ...
hash.index['primary']:get{3ULL}
| ---
| - [3, 'value1 v1.0', 'value2 v1.0']
| ...
hash.index['primary']:get{4ULL}
| ---
| ...
hash.index['primary']:get{5ULL}
| ---
| ...
-- select by valid NUM keys
hash.index['primary']:get{0}
| ---
| - [0, 'value1 v1.0', 'value2 v1.0']
| ...
hash.index['primary']:get{1}
| ---
| - [1, 'value1 v1.0', 'value2 v1.0']
| ...
hash.index['primary']:get{2}
| ---
| - [2, 'value1 v1.0', 'value2 v1.0']
| ...
hash.index['primary']:get{3}
| ---
| - [3, 'value1 v1.0', 'value2 v1.0']
| ...
hash.index['primary']:get{4}
| ---
| ...
hash.index['primary']:get{5}
| ---
| ...
-- select by invalid keys
hash.index['primary']:get{'invalid key'}
| ---
| - error: 'Supplied key type of part 0 does not match index part type: expected unsigned'
| ...
hash.index['primary']:get{'00000001', '00000002'}
| ---
| - error: Invalid key part count in an exact match (expected 1, got 2)
| ...
hash:drop()
| ---
| ...
|