From: Vladimír Vondruš Date: Tue, 12 May 2020 07:12:03 +0000 (+0200) Subject: documentation: improve search short data test to depend on header size. X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~cjwatson/git?a=commitdiff_plain;h=20374e7cbcd5a705640b9ab0d5001c33b558ac0f;p=blog.git documentation: improve search short data test to depend on header size. So when we move to bigger types, it still catches outdated assumptions. --- diff --git a/documentation/test/js-test-data/short.bin b/documentation/test/js-test-data/short.bin index e69de29b..ce004a84 100644 --- a/documentation/test/js-test-data/short.bin +++ b/documentation/test/js-test-data/short.bin @@ -0,0 +1 @@ +############# \ No newline at end of file diff --git a/documentation/test/populate-js-test-data.py b/documentation/test/populate-js-test-data.py index a6410a94..07ffe5ef 100755 --- a/documentation/test/populate-js-test-data.py +++ b/documentation/test/populate-js-test-data.py @@ -32,14 +32,14 @@ sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)))) sys.path.append(os.path.join(os.path.dirname(os.path.realpath(__file__)), '..')) from _search_test_metadata import EntryType, search_type_map -from _search import Trie, ResultMap, ResultFlag, serialize_search_data +from _search import Trie, ResultMap, ResultFlag, serialize_search_data, search_data_header_struct basedir = pathlib.Path(os.path.dirname(os.path.realpath(__file__)))/'js-test-data' # Basic error handling with open(basedir/'short.bin', 'wb') as f: - f.write(b'') + f.write(b'#'*(search_data_header_struct.size - 1)) with open(basedir/'wrong-magic.bin', 'wb') as f: f.write(b'MOS\1 ') with open(basedir/'wrong-version.bin', 'wb') as f: