From 20374e7cbcd5a705640b9ab0d5001c33b558ac0f Mon Sep 17 00:00:00 2001 From: =?utf8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Tue, 12 May 2020 09:12:03 +0200 Subject: [PATCH] documentation: improve search short data test to depend on header size. So when we move to bigger types, it still catches outdated assumptions. --- documentation/test/js-test-data/short.bin | 1 + documentation/test/populate-js-test-data.py | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) 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: -- 2.30.2