summaryrefslogtreecommitdiff
path: root/tests/analysis/scan
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2023-10-01 18:08:26 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2023-10-01 18:08:26 (GMT)
commit3ab6c0c0072ae0e2abde48d60d7eac18f084a764 (patch)
treeeb971388c5061dc91416924e98cc0c965fdcd19c /tests/analysis/scan
parent8c3fa9dab2ca7c46b6334fbbac5baf0fb822add0 (diff)
Introduce parameters for scan pattern modifiers.
Diffstat (limited to 'tests/analysis/scan')
-rw-r--r--tests/analysis/scan/pyapi.py25
1 files changed, 24 insertions, 1 deletions
diff --git a/tests/analysis/scan/pyapi.py b/tests/analysis/scan/pyapi.py
index 4b066f3..ff3143f 100644
--- a/tests/analysis/scan/pyapi.py
+++ b/tests/analysis/scan/pyapi.py
@@ -28,7 +28,7 @@ class TestRostPythonAPI(ChrysalideTestCase):
e = ScanExpression()
- def testBooleanComparison(self):
+ def __TODO__testBooleanComparison(self):
"""Compare custom scan expressions."""
class StrLenExpr(ScanExpression):
@@ -88,3 +88,26 @@ class TestRostPythonAPI(ChrysalideTestCase):
transformed = mod.transform(source)
self.assertEqual(source[::-1], transformed[0])
+
+
+ def testBytePatternModifiersAPI(self):
+ """Validate the API for pattern modifiers."""
+
+ mod = find_token_modifiers_for_name('plain')
+ self.assertIsNotNone(mod)
+
+ source = [ b'ABC', b'01234' ]
+ transformed = mod.transform(source)
+
+ self.assertEqual(len(source), len(transformed))
+ self.assertEqual(source[0], transformed[0])
+ self.assertEqual(source[1], transformed[1])
+
+
+ mod = find_token_modifiers_for_name('xor')
+ self.assertIsNotNone(mod)
+
+ source = [ b'ABC' ]
+ transformed = mod.transform(source, 0x20)
+
+ self.assertEqual(transformed[0], b'abc')