diff options
| author | J08nY | 2024-01-28 20:41:26 +0100 |
|---|---|---|
| committer | J08nY | 2024-01-28 20:41:26 +0100 |
| commit | 3720d55c229d62b848f90d8fcd6db5c3b937e6d1 (patch) | |
| tree | b38d0974072b31ae1772dbb1ae83dd86a4d6fc11 /test/sca | |
| parent | 418bbee40afe117a1ddf9fc86e87ad3f926921f1 (diff) | |
| download | pyecsca-3720d55c229d62b848f90d8fcd6db5c3b937e6d1.tar.gz pyecsca-3720d55c229d62b848f90d8fcd6db5c3b937e6d1.tar.zst pyecsca-3720d55c229d62b848f90d8fcd6db5c3b937e6d1.zip | |
Add dmap merging.
Diffstat (limited to 'test/sca')
| -rw-r--r-- | test/sca/test_tree.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/test/sca/test_tree.py b/test/sca/test_tree.py index 6ef83a8..ce16f97 100644 --- a/test/sca/test_tree.py +++ b/test/sca/test_tree.py @@ -20,6 +20,24 @@ def test_map(): assert dmap.codomain == {5, 3, 7, None} +def test_map_merge(): + cfgs = {"a", "b"} + binary_sets = {"a": {1, 2, 3}, "b": {2, 4}} + dmap1 = Map.from_sets(cfgs, binary_sets) + assert len(dmap1.mapping) == 2 + + cfgs = {"c", "d"} + binary_sets = {"c": {1, 2}, "d": {2, 4, 3}} + dmap2 = Map.from_sets(cfgs, binary_sets) + assert len(dmap2.mapping) == 2 + dmap1.merge(dmap2) + assert len(dmap1.mapping) == 4 + assert len(dmap1.cfg_map) == 4 + assert len(dmap1.codomain) == 2 + assert not dmap1["c", 3] + assert dmap1["a", 0] + + def test_build_tree(): cfgs = ["a", "b", "c"] cfg_map = pd.DataFrame([0, 1, 2], index=cfgs, columns=["vals"]) |
