<commit_before>"""
Test binary decision diagrams
"""<commit_msg>Implement expr2bdd function and unique table<commit_after>"""
Test binary decision diagrams
"""

from pyeda.bdd import expr2bdd
from pyeda.expr import var

a, b, c = map(var, 'abc')

def test_expr2bdd():
    f = a * b + a * c + b * c
    bdd_f = expr2bdd(f)
    assert bdd_f.root == a.var
    assert bdd_f.low.root == b.var
    assert bdd_f.high.root == b.var
    assert bdd_f.low.low.root == 0
    assert bdd_f.low.high.root == c.var
    assert bdd_f.high.low.root == c.var
    assert bdd_f.high.high.root == 1
    assert bdd_f.low.high.low.root == 0
    assert bdd_f.high.low.high.root == 1
{'fraction_non_alphanumeric': 0.13414634146341464, 'fraction_numerical': 0.012195121951219513, 'mean_word_length': 3.0306748466257667, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4189965', 'n_tokens_mistral': 263, 'n_tokens_neox': 257, 'n_words': 66}