Fix conflict_set.py bug, and add full inner words test
All checks were successful
Tests / Clang total: 1091, passed: 1091
Clang |Total|New|Outstanding|Fixed|Trend
|:-:|:-:|:-:|:-:|:-:
|0|0|0|0|:clap:
Tests / SIMD fallback total: 1091, passed: 1091
Tests / Release [gcc] total: 1091, passed: 1091
GNU C Compiler (gcc) |Total|New|Outstanding|Fixed|Trend
|:-:|:-:|:-:|:-:|:-:
|0|0|0|0|:clap:
Tests / Release [gcc,aarch64] total: 817, passed: 817
Tests / Coverage total: 818, passed: 818
weaselab/conflict-set/pipeline/head This commit looks good
All checks were successful
Tests / Clang total: 1091, passed: 1091
Clang |Total|New|Outstanding|Fixed|Trend
|:-:|:-:|:-:|:-:|:-:
|0|0|0|0|:clap:
Tests / SIMD fallback total: 1091, passed: 1091
Tests / Release [gcc] total: 1091, passed: 1091
GNU C Compiler (gcc) |Total|New|Outstanding|Fixed|Trend
|:-:|:-:|:-:|:-:|:-:
|0|0|0|0|:clap:
Tests / Release [gcc,aarch64] total: 817, passed: 817
Tests / Coverage total: 818, passed: 818
weaselab/conflict-set/pipeline/head This commit looks good
Apparently all bytes were 0
This commit is contained in:
@@ -1,14 +1,21 @@
|
||||
from conflict_set import *
|
||||
|
||||
|
||||
build_dir = None
|
||||
|
||||
|
||||
class DebugConflictSet:
|
||||
"""
|
||||
Bisimulates the skip list and radix tree conflict sets for testing purposes
|
||||
"""
|
||||
|
||||
def __init__(self, version: int = 0) -> None:
|
||||
self.skip_list = ConflictSet(version, implementation="skip_list")
|
||||
self.radix_tree = ConflictSet(version, implementation="radix_tree")
|
||||
self.skip_list = ConflictSet(
|
||||
version, build_dir=build_dir, implementation="skip_list"
|
||||
)
|
||||
self.radix_tree = ConflictSet(
|
||||
version, build_dir=build_dir, implementation="radix_tree"
|
||||
)
|
||||
|
||||
def addWrites(self, version: int, *writes: WriteRange):
|
||||
self.skip_list.addWrites(version, *writes)
|
||||
@@ -49,6 +56,16 @@ def test_conflict_set():
|
||||
assert cs.check(read(0, key)) == [Result.TOO_OLD]
|
||||
|
||||
|
||||
def test_inner_full_words():
|
||||
with DebugConflictSet() as cs:
|
||||
cs.addWrites(1, write(b"\x3f\x61"), write(b"\x81\x61"))
|
||||
writes = []
|
||||
for i in range(0x40, 0x81):
|
||||
writes.append(write(bytes([i, 0x61])))
|
||||
cs.addWrites(2, *writes)
|
||||
cs.check(read(1, b"\x21", b"\xc2"))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
# budget "pytest" for ctest integration without pulling in a dependency. You can of course still use pytest in local development.
|
||||
import argparse
|
||||
@@ -61,6 +78,7 @@ if __name__ == "__main__":
|
||||
list_parser = subparsers.add_parser("list")
|
||||
test_parser = subparsers.add_parser("test")
|
||||
test_parser.add_argument("test")
|
||||
test_parser.add_argument("--build-dir")
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
@@ -74,4 +92,5 @@ if __name__ == "__main__":
|
||||
)
|
||||
)
|
||||
elif args.command == "test":
|
||||
build_dir = args.build_dir
|
||||
globals()["test_" + args.test]()
|
||||
|
Reference in New Issue
Block a user