Show More
@@ -2,6 +2,7 b'' | |||||
2 |
|
2 | |||
3 | from __future__ import absolute_import, print_function |
|
3 | from __future__ import absolute_import, print_function | |
4 |
|
4 | |||
|
5 | import collections | |||
5 | import hashlib |
|
6 | import hashlib | |
6 | import sys |
|
7 | import sys | |
7 |
|
8 | |||
@@ -397,6 +398,24 b' def issnapshottest(rlog):' | |||||
397 | print(' expected: %s' % snapshots) |
|
398 | print(' expected: %s' % snapshots) | |
398 | print(' got: %s' % result) |
|
399 | print(' got: %s' % result) | |
399 |
|
400 | |||
|
401 | snapshotmapall = {0: [6, 8, 11, 17, 19, 25], 8: [21], -1: [0, 30]} | |||
|
402 | snapshotmap15 = {0: [17, 19, 25], 8: [21], -1: [30]} | |||
|
403 | def findsnapshottest(rlog): | |||
|
404 | resultall = collections.defaultdict(list) | |||
|
405 | deltas._findsnapshots(rlog, resultall, 0) | |||
|
406 | resultall = dict(resultall.items()) | |||
|
407 | if resultall != snapshotmapall: | |||
|
408 | print('snapshot map differ:') | |||
|
409 | print(' expected: %s' % snapshotmapall) | |||
|
410 | print(' got: %s' % resultall) | |||
|
411 | result15 = collections.defaultdict(list) | |||
|
412 | deltas._findsnapshots(rlog, result15, 15) | |||
|
413 | result15 = dict(result15.items()) | |||
|
414 | if result15 != snapshotmap15: | |||
|
415 | print('snapshot map differ:') | |||
|
416 | print(' expected: %s' % snapshotmap15) | |||
|
417 | print(' got: %s' % result15) | |||
|
418 | ||||
400 | def maintest(): |
|
419 | def maintest(): | |
401 | expected = rl = None |
|
420 | expected = rl = None | |
402 | with newtransaction() as tr: |
|
421 | with newtransaction() as tr: | |
@@ -424,6 +443,8 b' def maintest():' | |||||
424 | rl5 = makesnapshot(tr) |
|
443 | rl5 = makesnapshot(tr) | |
425 | issnapshottest(rl5) |
|
444 | issnapshottest(rl5) | |
426 | print('issnapshot test passed') |
|
445 | print('issnapshot test passed') | |
|
446 | findsnapshottest(rl5) | |||
|
447 | print('findsnapshot test passed') | |||
427 |
|
448 | |||
428 | try: |
|
449 | try: | |
429 | maintest() |
|
450 | maintest() |
General Comments 0
You need to be logged in to leave comments.
Login now