File tree Expand file tree Collapse file tree 2 files changed +35
-1
lines changed Expand file tree Collapse file tree 2 files changed +35
-1
lines changed Original file line number Diff line number Diff line change 4
4
#include <stdint.h>
5
5
#include "Python.h"
6
6
7
- #define _Py_HAMT_MAX_TREE_DEPTH 7
7
+ #define _Py_HAMT_MAX_TREE_DEPTH 8
8
8
9
9
10
10
#define Map_Check (o ) (Py_TYPE(o) == &_Map_Type)
Original file line number Diff line number Diff line change @@ -254,6 +254,40 @@ def test_map_stress_01(self):
254
254
self .assertEqual (len (h ), 0 )
255
255
self .assertEqual (list (h .items ()), [])
256
256
257
+ def test_map_collision_3 (self ):
258
+ # Test that iteration works with the deepest tree possible.
259
+
260
+ C = HashKey (0b10000000_00000000_00000000_00000000 , 'C' )
261
+ D = HashKey (0b10000000_00000000_00000000_00000000 , 'D' )
262
+
263
+ E = HashKey (0b00000000_00000000_00000000_00000000 , 'E' )
264
+
265
+ h = self .Map ()
266
+ h = h .set (C , 'C' )
267
+ h = h .set (D , 'D' )
268
+ h = h .set (E , 'E' )
269
+
270
+ # BitmapNode(size=2 count=1 bitmap=0b1):
271
+ # NULL:
272
+ # BitmapNode(size=2 count=1 bitmap=0b1):
273
+ # NULL:
274
+ # BitmapNode(size=2 count=1 bitmap=0b1):
275
+ # NULL:
276
+ # BitmapNode(size=2 count=1 bitmap=0b1):
277
+ # NULL:
278
+ # BitmapNode(size=2 count=1 bitmap=0b1):
279
+ # NULL:
280
+ # BitmapNode(size=2 count=1 bitmap=0b1):
281
+ # NULL:
282
+ # BitmapNode(size=4 count=2 bitmap=0b101):
283
+ # <Key name:E hash:0>: 'E'
284
+ # NULL:
285
+ # CollisionNode(size=4 id=0x107a24520):
286
+ # <Key name:C hash:2147483648>: 'C'
287
+ # <Key name:D hash:2147483648>: 'D'
288
+
289
+ self .assertEqual ({k .name for k in h .keys ()}, {'C' , 'D' , 'E' })
290
+
257
291
def test_map_stress_02 (self ):
258
292
COLLECTION_SIZE = 20000
259
293
TEST_ITERS_EVERY = 647
You can’t perform that action at this time.
0 commit comments