aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/sca/test_match.py
diff options
context:
space:
mode:
authorJ08nY2020-03-04 00:04:53 +0100
committerJ08nY2020-03-04 00:04:53 +0100
commita97f49ebe3c8e28d2a9ba76711555a3378b62341 (patch)
treed6064aec39573ad9e83607dbed5873d7872aed21 /test/sca/test_match.py
parentdeca0e3d89ff4483dd6b6b4ad99b3400145bee5b (diff)
downloadpyecsca-a97f49ebe3c8e28d2a9ba76711555a3378b62341.tar.gz
pyecsca-a97f49ebe3c8e28d2a9ba76711555a3378b62341.tar.zst
pyecsca-a97f49ebe3c8e28d2a9ba76711555a3378b62341.zip
Fix some type issues.
Diffstat (limited to 'test/sca/test_match.py')
-rw-r--r--test/sca/test_match.py19
1 files changed, 10 insertions, 9 deletions
diff --git a/test/sca/test_match.py b/test/sca/test_match.py
index 9cbd284..b8663c7 100644
--- a/test/sca/test_match.py
+++ b/test/sca/test_match.py
@@ -9,21 +9,22 @@ from .utils import plot
class MatchingTests(TestCase):
def test_simple_match(self):
- pattern = Trace(None, None,
- np.array([1, 15, 12, -10, 0, 13, 17, -1, 0], dtype=np.dtype("i1")))
- base = Trace(None, None, np.array(
+ pattern = Trace(np.array([1, 15, 12, -10, 0, 13, 17, -1, 0], dtype=np.dtype("i1")), None,
+ None)
+ base = Trace(np.array(
[0, 1, 3, 1, 2, -2, -3, 1, 15, 12, -10, 0, 13, 17, -1, 0, 3, 1],
- dtype=np.dtype("i1")))
+ dtype=np.dtype("i1")), None, None)
filtered = match_part(base, 7, 9)
self.assertListEqual(filtered, [7])
plot(self, base=base, pattern=pad(pattern, (filtered[0], 0)))
def test_multiple_match(self):
- pattern = Trace(None, None,
- np.array([1, 15, 12, -10, 0, 13, 17, -1, 0], dtype=np.dtype("i1")))
- base = Trace(None, None, np.array(
- [0, 1, 3, 1, 2, -2, -3, 1, 18, 10, -5, 0, 13, 17, -1, 0, 3, 1, 2, 5, 13, 8, -8, 1, 11, 15, 0, 1, 5, 2, 4],
- dtype=np.dtype("i1")))
+ pattern = Trace(np.array([1, 15, 12, -10, 0, 13, 17, -1, 0], dtype=np.dtype("i1")), None,
+ None)
+ base = Trace(np.array(
+ [0, 1, 3, 1, 2, -2, -3, 1, 18, 10, -5, 0, 13, 17, -1, 0, 3, 1, 2, 5, 13, 8, -8, 1,
+ 11, 15, 0, 1, 5, 2, 4],
+ dtype=np.dtype("i1")), None, None)
filtered = match_pattern(base, pattern, 0.9)
self.assertListEqual(filtered, [7, 19])
plot(self, base=base, pattern1=pad(pattern, (filtered[0], 0)), pattern2=pad(pattern, (filtered[1], 0)))