-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_benchmark.py
More file actions
27 lines (19 loc) · 813 Bytes
/
Copy pathtest_benchmark.py
File metadata and controls
27 lines (19 loc) · 813 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
"""The benchmark claim, locked into CI.
simdiff must catch every obfuscated-effect attack at zero false positives, and
must strictly beat signature/keyword argument scanning on recall. If this ever
regresses, CI fails — the README number cannot drift from reality.
"""
from bench.run import run
def test_simdiff_perfect_recall_zero_fp():
m = run()
assert m["simdiff"]["recall"] == 1.0
assert m["simdiff"]["false_positive_rate"] == 0.0
def test_simdiff_strictly_beats_keyword_scanning_on_recall():
m = run()
assert m["simdiff"]["recall"] > m["keyword"]["recall"]
# keyword scanning misses the obfuscated majority
assert m["keyword"]["recall"] < 0.5
def test_corpus_has_both_classes():
m = run()
assert m["counts"]["dangerous"] >= 6
assert m["counts"]["safe"] >= 5