aboutsummaryrefslogtreecommitdiff
path: root/test/test_process.py
diff options
context:
space:
mode:
Diffstat (limited to 'test/test_process.py')
-rw-r--r--test/test_process.py16
1 files changed, 10 insertions, 6 deletions
diff --git a/test/test_process.py b/test/test_process.py
index 130d51f..a3ba85f 100644
--- a/test/test_process.py
+++ b/test/test_process.py
@@ -1,7 +1,8 @@
from unittest import TestCase
import numpy as np
-from pyecsca import Trace, absolute, invert, threshold, rolling_mean, offset, recenter
+from pyecsca import Trace, absolute, invert, threshold, rolling_mean, offset, recenter, normalize, normalize_wl
+from .utils import plot
class ProcessTests(TestCase):
@@ -12,26 +13,22 @@ class ProcessTests(TestCase):
def test_absolute(self):
result = absolute(self._trace)
self.assertIsNotNone(result)
- self.assertIsInstance(result, Trace)
self.assertEqual(result.samples[1], 60)
def test_invert(self):
result = invert(self._trace)
self.assertIsNotNone(result)
- self.assertIsInstance(result, Trace)
np.testing.assert_equal(result.samples, [-30, 60, -145, -247])
def test_threshold(self):
result = threshold(self._trace, 128)
self.assertIsNotNone(result)
- self.assertIsInstance(result, Trace)
self.assertEqual(result.samples[0], 0)
self.assertEqual(result.samples[2], 1)
def test_rolling_mean(self):
result = rolling_mean(self._trace, 2)
self.assertIsNotNone(result)
- self.assertIsInstance(result, Trace)
self.assertEqual(len(result.samples), 3)
self.assertEqual(result.samples[0], -15)
self.assertEqual(result.samples[1], 42)
@@ -40,8 +37,15 @@ class ProcessTests(TestCase):
def test_offset(self):
result = offset(self._trace, 5)
self.assertIsNotNone(result)
- self.assertIsInstance(result, Trace)
np.testing.assert_equal(result.samples, np.array([35, -55, 150, 252], dtype=np.dtype("i2")))
def test_recenter(self):
self.assertIsNotNone(recenter(self._trace))
+
+ def test_normalize(self):
+ result = normalize(self._trace)
+ self.assertIsNotNone(result)
+
+ def test_normalize_wl(self):
+ result = normalize_wl(self._trace)
+ self.assertIsNotNone(result) \ No newline at end of file