Skip to content

Commit 1f3dc1c

Browse files
authored
Merge pull request #21 from cucapra/testing-refactor
refactor testing!
2 parents cd8def1 + e52c118 commit 1f3dc1c

231 files changed

Lines changed: 1851 additions & 823 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/diff-test.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,5 @@ jobs:
3535
./configure.sh && make
3636
sudo make PREFIX=/usr/local install
3737
38-
- name: Compare simulations and record times
39-
run: turnt --diff tests/simulation/inputs/*.aag
40-
41-
38+
- name: Compare Rust simulations against C AIGER
39+
run: turnt --diff -e rust -e c tests/inputs/*.aag

.github/workflows/snapshot-test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,4 @@ jobs:
4141
run: cargo build
4242

4343
- name: Run AIGER snapshot tests
44-
run: turnt tests/aiger/inputs/*.aag
44+
run: turnt -e raw -e opt tests/inputs/*.aag

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
/target
22
.DS_Store
33
.idea/
4+
scripts/__pycache__
5+
.venv

internal_rep.md

Lines changed: 0 additions & 112 deletions
This file was deleted.
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
from pathlib import Path
2+
from random import Random
3+
4+
SCRIPT_DIR = Path(__file__).resolve().parent
5+
INPUT_DIR = SCRIPT_DIR.parent / "tests" / "inputs"
6+
7+
8+
def write_stimulus(aag_path: Path) -> None:
9+
# get I and L from 'aag M I L O A'
10+
aag_header = aag_path.read_text().split()
11+
I = int(aag_header[2])
12+
L = int(aag_header[3])
13+
14+
# just for fun: use path name as random seed!
15+
# (not necessary AT ALL but I think it's cool)
16+
rng = Random(aag_path.name)
17+
clock_cycles = 1 if L == 0 else 2**L + 1
18+
input_rows = []
19+
for _ in range(clock_cycles):
20+
input_rows.append("".join(rng.choice("01") for _ in range(I)))
21+
22+
stim_path = aag_path.with_suffix(".stim")
23+
24+
with open(stim_path, 'w') as f:
25+
for row in input_rows:
26+
print(row, file=f)
27+
print('.', file =f)
28+
29+
print(f"wrote {stim_path}")
30+
31+
32+
def main() -> None:
33+
for aag_path in sorted(INPUT_DIR.glob("*.aag")):
34+
write_stimulus(aag_path)
35+
36+
print(f"wrote AIGER stimulus inputs to {INPUT_DIR}")
37+
38+
39+
if __name__ == "__main__":
40+
main()

0 commit comments

Comments
 (0)