aboutsummaryrefslogtreecommitdiff
path: root/tools/sim_screenshot.py
diff options
context:
space:
mode:
authorcirakg <cirakg@cirakg.xyz>2026-10-18 23:44:18 +0200
committercirakg <cirakg@cirakg.xyz>2026-10-18 23:44:18 +0200
commit93aa7e3aa291f3328cf34a5a2f86172f41d0affd (patch)
treeac44438e7340fde609ad6458e31e122612cf35d1 /tools/sim_screenshot.py
parent5646ae7f40dc53c9ebed0b3b6e907cc85fcd5993 (diff)
test: add cross-checked crypto/OTP vectors, unit tests and stricter screenshots
- gen_vectors.py: RFC/FIPS/NIST vectors recomputed with Python's stdlib (openssl for AES) before use, plus seeded cases around SHA padding boundaries, 2038 and 2100; generates test/data/Vectors.mc. - 31 Monkey C tests (hashes, HMAC, PBKDF2, HKDF, AES, sealed records incl. every-byte tamper detection, Base32 errors, 100 OTP and 12 Steam vectors, clock, jobs) and a benchmark; pass on all four test devices. - Screenshot tolerance 0.01 %: one changed character no longer passes. - Golden images updated for version 0.2.0. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'tools/sim_screenshot.py')
-rw-r--r--tools/sim_screenshot.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/tools/sim_screenshot.py b/tools/sim_screenshot.py
index 81b41b6..5517b78 100644
--- a/tools/sim_screenshot.py
+++ b/tools/sim_screenshot.py
@@ -16,7 +16,8 @@ Steps:
black out the corners of round displays, which show bezel, not screen.
3. Fail if the screen is blank (the app drew nothing).
4. With --golden, compare with the approved image: the check fails when more
- than 0.5 % of the pixels differ by more than 24 levels in any channel. A
+ than 0.01 % of the pixels differ by more than 24 levels in any channel (less
+ than one changed character; rendering is deterministic). A
diff image (differences in red) is written next to --out.
5. With --approve, save the screen as the new golden image instead.
@@ -40,7 +41,7 @@ MAX_OFFSET_X, MAX_OFFSET_Y = 16, 64 # search range for the device drawing
MIN_OVERLAP = 0.9 # the window may clip the drawing's edge, but not more than this
MAX_BEZEL_DIFF = 6.0 # mean absolute difference per channel at the best offset
PIXEL_TOLERANCE = 24 # per-channel difference that still counts as equal
-MAX_DIFF_FRACTION = 0.005 # share of pixels allowed to differ
+MAX_DIFF_FRACTION = 0.0001 # share of pixels allowed to differ: below one changed character
MIN_SCREEN_STDDEV = 2.0 # below this the screen counts as blank