diff options
| author | J08nY | 2024-01-21 16:45:59 +0100 |
|---|---|---|
| committer | J08nY | 2024-01-21 16:45:59 +0100 |
| commit | be72b8394979942c17279f7f98fb73f4e08af0f3 (patch) | |
| tree | 57b5109c8ba0f5edb66653f61d710481548bcc88 /test/sca/test_tree.py | |
| parent | f26ec844f8582c8e4861c0bc8005d22fdae934f2 (diff) | |
| download | pyecsca-be72b8394979942c17279f7f98fb73f4e08af0f3.tar.gz pyecsca-be72b8394979942c17279f7f98fb73f4e08af0f3.tar.zst pyecsca-be72b8394979942c17279f7f98fb73f4e08af0f3.zip | |
Diffstat (limited to 'test/sca/test_tree.py')
| -rw-r--r-- | test/sca/test_tree.py | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/test/sca/test_tree.py b/test/sca/test_tree.py index 3dbb960..5ee6324 100644 --- a/test/sca/test_tree.py +++ b/test/sca/test_tree.py @@ -1,3 +1,6 @@ +import io +from contextlib import redirect_stdout + from pyecsca.sca.re.tree import Tree, Map import pandas as pd @@ -12,5 +15,20 @@ def test_build_tree(): mapping2 = pd.DataFrame([(1, 0, 0), (2, 0, 0), (3, 0, 0)], columns=inputs2, index=cfgs) dmap2 = Map(None, mapping2) tree = Tree.build(set(cfgs), dmap1, dmap2) - print() - tree.render()
\ No newline at end of file + with redirect_stdout(io.StringIO()): + tree.render() + tree.describe() + + +def test_expand_tree(): + cfgs = ["a", "b", "c"] + inputs1 = [1, 2] + mapping1 = pd.DataFrame([(0, 4), (0, 3), (0, 4)], columns=inputs1, index=cfgs) + dmap1 = Map(None, mapping1) + + inputs2 = ["f", "e", "d"] + mapping2 = pd.DataFrame([(1, 0, 0), (2, 0, 0), (3, 0, 0)], columns=inputs2, index=cfgs) + dmap2 = Map(None, mapping2) + tree = Tree.build(set(cfgs), dmap1) + res = tree.expand(dmap2) + assert res.height > tree.height |
