Skip to content

Commit 2a7f7dd

Browse files
committed
Added test against multiple outputs.
1 parent 828b235 commit 2a7f7dd

File tree

3 files changed

+61
-45
lines changed

3 files changed

+61
-45
lines changed

aiger/parser.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
from bidict import bidict
1010
from toposort import toposort_flatten
1111
from uuid import uuid1
12-
from sortedcontainers import SortedSet, SortedDict
12+
from sortedcontainers import SortedList, SortedSet, SortedDict
1313

1414
import aiger as A
1515

@@ -60,7 +60,7 @@ class SymbolTable:
6060
class State:
6161
header: Optional[Header] = None
6262
inputs: SortedSet = attr.ib(factory=SortedSet)
63-
outputs: SortedSet = attr.ib(factory=SortedSet)
63+
outputs: SortedList = attr.ib(factory=SortedList)
6464
latches: SortedSet = attr.ib(factory=SortedSet)
6565
symbols: SymbolTable = attr.ib(factory=SymbolTable)
6666
comments: Optional[List[str]] = None
@@ -223,7 +223,7 @@ def parse_seq():
223223

224224
def finish_table(table, keys):
225225
assert len(table) <= len(keys)
226-
return bidict({table[i]: key for i, key in enumerate(keys)})
226+
return {table[i]: key for i, key in enumerate(keys)}
227227

228228

229229
def parse(lines, to_aig: bool = True):

poetry.lock

Lines changed: 51 additions & 42 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/test_parser.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ def test_mutex_example_smoke():
7777

7878
def test_degenerate_smoke():
7979
import aiger as A
80+
8081
expr = A.BoolExpr(A.parse("""aag 0 0 0 1 0
8182
0
8283
"""))
@@ -89,3 +90,9 @@ def test_degenerate_smoke():
8990
""")
9091
assert len(circ.node_map) == 0
9192
assert circ.inputs == circ.outputs == circ.latches == set()
93+
94+
circ = A.parse("""aag 0 0 0 2 0
95+
0
96+
0
97+
""")
98+
assert not any(circ({})[0].values())

0 commit comments

Comments
 (0)