diff options
| author | J08nY | 2025-03-08 19:49:21 +0100 |
|---|---|---|
| committer | J08nY | 2025-03-08 19:49:21 +0100 |
| commit | 6fcfde015b74257f848eca67f564ff60ef3e4661 (patch) | |
| tree | 4725e1e5a318fbc6c681768d94b9af4646871e28 /test/ec/test_context.py | |
| parent | eaadd3e8a271fdbc0f6c409826d814fde7f9ef28 (diff) | |
| download | pyecsca-6fcfde015b74257f848eca67f564ff60ef3e4661.tar.gz pyecsca-6fcfde015b74257f848eca67f564ff60ef3e4661.tar.zst pyecsca-6fcfde015b74257f848eca67f564ff60ef3e4661.zip | |
Diffstat (limited to 'test/ec/test_context.py')
| -rw-r--r-- | test/ec/test_context.py | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/test/ec/test_context.py b/test/ec/test_context.py index f76995b..e82f852 100644 --- a/test/ec/test_context.py +++ b/test/ec/test_context.py @@ -1,11 +1,6 @@ import pytest -from pyecsca.ec.context import ( - local, - DefaultContext, - Node, - PathContext, Action -) +from pyecsca.ec.context import local, DefaultContext, Node, PathContext, Action from pyecsca.ec.key_generation import KeyGeneration from pyecsca.ec.mod import RandomModAction from pyecsca.ec.mult import LTRMultiplier, ScalarMultiplicationAction @@ -51,10 +46,13 @@ def test_render(): Node(other_a, parent=a) txt = tree.render() - assert txt == """Action() + assert ( + txt + == """Action() └──Action() ├──Action() └──Action()""" + ) @pytest.fixture() @@ -89,6 +87,7 @@ def test_default_no_enter(): with local(DefaultContext()) as default, pytest.raises(ValueError): default.exit_action(RandomModAction(7)) + def test_multiple_enter(mult): default = DefaultContext() with local(default) as ctx1: @@ -100,6 +99,7 @@ def test_multiple_enter(mult): assert len(default.actions) == 0 assert len(ctx1.actions) == len(ctx2.actions) + def test_multiple_enter_chained(mult): default = DefaultContext() with local(default) as ctx1: @@ -111,6 +111,7 @@ def test_multiple_enter_chained(mult): assert len(default.actions) == 0 assert 2 * len(ctx1.actions) == len(ctx2.actions) + def test_multiple_enter_no_copy(mult): default = DefaultContext() with local(default, copy=False) as ctx1: @@ -122,6 +123,7 @@ def test_multiple_enter_no_copy(mult): assert len(default.actions) == len(ctx1.actions) assert len(ctx1.actions) == len(ctx2.actions) + def test_path(mult, secp128r1): with local(PathContext([0, 1])) as ctx: key_generator = KeyGeneration(mult, secp128r1, True) |
