This instance will be upgraded to Heptapod 0.17.2 on 2020-12-03 at 14:00 UTC+1 (a few minutes of down time)

Commit 51e94122 authored by Jesse McGrew's avatar Jesse McGrew

Improved code generation for AND/OR to not need temp variables as often.

parent 7388c6352fcc
......@@ -185,5 +185,47 @@ namespace IntegrationTests
AssertRoutine("\"AUX\" X", "<COND (.X <PRINTI \"foo\">) (T <PRINTI \"bar\">)> <CRLF> <RTRUE>")
.GeneratesCodeMatching("PRINTR \"foo\".*PRINTR \"bar\"");
}
[TestMethod]
public void TestSimpleAND_1()
{
AssertRoutine("\"AUX\" A", "<AND .A <FOO>>")
.WithGlobal("<ROUTINE FOO () <>>")
.GeneratesCodeMatching(@"^(?:(?!\?TMP).)*$");
}
[TestMethod]
public void TestSimpleAND_2()
{
AssertRoutine("\"AUX\" A", "<AND <OR <0? .A> <FOO>> <BAR>>")
.WithGlobal("<ROUTINE FOO () <>>")
.WithGlobal("<ROUTINE BAR () <>>")
.GeneratesCodeMatching(@"^(?:(?!\?TMP).)*$");
}
[TestMethod]
public void TestSimpleOR_1()
{
AssertRoutine("\"AUX\" A", "<OR .A <FOO>>")
.WithGlobal("<ROUTINE FOO () <>>")
.GeneratesCodeMatching(@"^(?:(?!\?TMP).)*$");
}
[TestMethod]
public void TestSimpleOR_2()
{
AssertRoutine("\"AUX\" OBJ", "<OR <FIRST? .OBJ> <FOO>>")
.WithGlobal("<ROUTINE FOO () <>>")
.GeneratesCodeMatching(@"RETURN \?TMP.*RSTACK");
}
[TestMethod]
public void TestSimpleOR_3()
{
AssertRoutine("\"AUX\" A", "<OR <SET A <FOO>> <BAR>>")
.WithGlobal("<ROUTINE FOO () <>>")
.WithGlobal("<ROUTINE BAR () <>>")
.GeneratesCodeMatching(@"^(?:(?!\?TMP).)*$");
}
}
}
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment