diff options
| author | J08nY | 2019-05-01 23:26:44 +0200 |
|---|---|---|
| committer | J08nY | 2019-05-01 23:26:44 +0200 |
| commit | 5a335a3b3aeaf2627dc5c39865b843da67553b38 (patch) | |
| tree | 1256011a82296f9e8cbf8d34c44f1f0d6d83999c /test/sca | |
| parent | 2a109ad4502bc7983c9fd4fc29a62b6f028762b0 (diff) | |
| download | pyecsca-5a335a3b3aeaf2627dc5c39865b843da67553b38.tar.gz pyecsca-5a335a3b3aeaf2627dc5c39865b843da67553b38.tar.zst pyecsca-5a335a3b3aeaf2627dc5c39865b843da67553b38.zip | |
Add Kolmogorov-Smirnov tests.
Diffstat (limited to 'test/sca')
| -rw-r--r-- | test/sca/test_test.py (renamed from test/sca/test_ttest.py) | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/test/sca/test_ttest.py b/test/sca/test_test.py index 02f78c5..898c6d6 100644 --- a/test/sca/test_ttest.py +++ b/test/sca/test_test.py @@ -1,7 +1,8 @@ from unittest import TestCase import numpy as np -from pyecsca.sca import Trace, welch_ttest, student_ttest + +from pyecsca.sca import Trace, welch_ttest, student_ttest, ks_test class TTestTests(TestCase): @@ -17,9 +18,22 @@ class TTestTests(TestCase): a = Trace(None, None, np.array([19.8, 20.4, 19.6, 17.8, 18.5, 18.9, 18.3, 18.9, 19.5, 22.0])) b = Trace(None, None, np.array([28.2, 26.6, 20.1, 23.3, 25.2, 22.1, 17.7, 27.6, 20.6, 13.7])) c = Trace(None, None, np.array([20.2, 21.6, 27.1, 13.3, 24.2, 20.1, 11.7, 25.6, 26.6, 21.4])) - + result = welch_ttest([a, b], [b, c]) self.assertIsNotNone(result) def test_students_ttest(self): + self.assertIsNone(student_ttest([], [])) self.assertIsNotNone(student_ttest([self.a, self.b], [self.c, self.d])) + + +class KolmogorovSmirnovTests(TestCase): + + def test_ks_test(self): + self.assertIsNone(ks_test([], [])) + + a = Trace(None, b"\xff", np.array([20, 80], dtype=np.dtype("i1"))) + b = Trace(None, b"\xff", np.array([30, 42], dtype=np.dtype("i1"))) + c = Trace(None, b"\x00", np.array([78, 56], dtype=np.dtype("i1"))) + d = Trace(None, b"\x00", np.array([98, 36], dtype=np.dtype("i1"))) + self.assertIsNotNone(ks_test([a, b], [c, d])) |
