[GEMINI] Add test case for check_for_flag function
This commit is contained in:
@@ -133,3 +133,20 @@ def test_try_decode_metadata_rot13_unique_only():
|
|||||||
assert "rot13" not in res_duplicate
|
assert "rot13" not in res_duplicate
|
||||||
# }}}
|
# }}}
|
||||||
|
|
||||||
|
# {{{ test_check_for_flag
|
||||||
|
def test_check_for_flag():
|
||||||
|
"""
|
||||||
|
Verifies that check_for_flag extracts multiple matching flags or returns empty list.
|
||||||
|
"""
|
||||||
|
from ctf.decoding import check_for_flag
|
||||||
|
# Default fallback - matches multiple
|
||||||
|
res = check_for_flag("flag{one} and flag{two}")
|
||||||
|
assert set(res) == {"flag{one}", "flag{two}"}
|
||||||
|
# Custom format
|
||||||
|
res_custom = check_for_flag("custom{first} custom{second}", r"custom\{[a-z]+\}")
|
||||||
|
assert set(res_custom) == {"custom{first}", "custom{second}"}
|
||||||
|
# No matches
|
||||||
|
assert check_for_flag("no flag matches here") == []
|
||||||
|
# }}}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user