diff options
| author | J08nY | 2018-12-11 21:24:35 +0100 |
|---|---|---|
| committer | J08nY | 2019-03-21 11:00:14 +0100 |
| commit | 0c740f412626f33f08d6bb9857f0c5619b9ea79c (patch) | |
| tree | c2313faaf8bc878d3d72acf2fd7c830b9512a529 /test/sca/test_edit.py | |
| parent | cbeca585d5787e8cab35fb5207339e7b22eab382 (diff) | |
| download | pyecsca-0c740f412626f33f08d6bb9857f0c5619b9ea79c.tar.gz pyecsca-0c740f412626f33f08d6bb9857f0c5619b9ea79c.tar.zst pyecsca-0c740f412626f33f08d6bb9857f0c5619b9ea79c.zip | |
Diffstat (limited to 'test/sca/test_edit.py')
| -rw-r--r-- | test/sca/test_edit.py | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/test/sca/test_edit.py b/test/sca/test_edit.py new file mode 100644 index 0000000..88376aa --- /dev/null +++ b/test/sca/test_edit.py @@ -0,0 +1,28 @@ +from unittest import TestCase + +import numpy as np + +from pyecsca.sca import Trace, trim, reverse, pad + + +class EditTests(TestCase): + + def setUp(self): + self._trace = Trace(None, None, np.array([10, 20, 30, 40, 50], dtype=np.dtype("i1"))) + + def test_trim(self): + result = trim(self._trace, 2) + self.assertIsNotNone(result) + np.testing.assert_equal(result.samples, np.array([30, 40, 50], dtype=np.dtype("i1"))) + + def test_reverse(self): + result = reverse(self._trace) + self.assertIsNotNone(result) + np.testing.assert_equal(result.samples, + np.array([50, 40, 30, 20, 10], dtype=np.dtype("i1"))) + + def test_pad(self): + result = pad(self._trace, 2) + self.assertIsNotNone(result) + np.testing.assert_equal(result.samples, + np.array([0, 0, 10, 20, 30, 40, 50, 0, 0], dtype=np.dtype("i1"))) |
