Skip to content

Commit

Permalink
added larger tests for the search-based optimizer
Browse files Browse the repository at this point in the history
  • Loading branch information
Santiago Ontañón authored and Santiago Ontañón committed May 9, 2021
1 parent ac9b898 commit 3ca87f0
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/test/java/test/SearchBasedOptimizerTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@ public SearchBasedOptimizerTest() {
// @Test public void testLShift12() throws IOException { test("data/searchtests/test-large4.txt", "data/searchtests/test-large4-expected.asm"); }
// Current version: 86.859 sec (736701521 solutions tested)
// @Test public void testLShift13() throws IOException { test("data/searchtests/test-large5.txt", "data/searchtests/test-large5-expected.asm"); }
// Current version: 238.813 sec (6256071288 solutions tested, 8-threads)
// @Test public void testLShift13Hard() throws IOException { test("data/searchtests/test-large6.txt", "data/searchtests/test-large6-expected.asm"); }
// Current version: - sec (- solutions tested)
// @Test public void testLShift13HardSpeed() throws IOException { test("data/searchtests/test-large6.txt", "data/searchtests/test-large6-expected.asm", "-so-time"); }


private void test(String inputFile, String expectedOutput) throws IOException
Expand Down
10 changes: 9 additions & 1 deletion src/test/resources/data/searchtests/test-large5-expected.asm
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,12 @@
add hl, hl
add hl, hl
ld h, l
ld l, 0
ld l, 0
----
ld h, l
ld l, 0
add hl, hl
add hl, hl
add hl, hl
add hl, hl
add hl, hl
15 changes: 15 additions & 0 deletions src/test/resources/data/searchtests/test-large6-expected.asm
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
add hl, hl
add hl, hl
add hl, hl
add hl, hl
add hl, hl
ld h, l
ld l, 0
----
ld h, l
ld l, 0
add hl, hl
add hl, hl
add hl, hl
add hl, hl
add hl, hl
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
ld a, l
rrca
rrca
rrca
and 224
ld h, a
ld l, 0
13 changes: 13 additions & 0 deletions src/test/resources/data/searchtests/test-large6.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
allowed_ops:
logic
ld
addition
rotation
allow_ram_use = false
allowed_registers: a, hl
8bit_constants: 0, 224
max_ops = 7
initial_state:
HL = val
goal_state:
HL = val << 13

0 comments on commit 3ca87f0

Please sign in to comment.