Test for DW directive with strings (#228)

This commit is contained in:
simon987 2020-07-30 18:40:34 -04:00
parent 319abad130
commit fe299fe061
2 changed files with 24 additions and 1 deletions

View File

@ -0,0 +1,23 @@
package net.simon987.mar.server.assembly;
import net.simon987.mar.server.TestExecutionResult;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
public class DwDirectiveTest {
@Test
public void dwStringWikiExample() {
String code = "" +
"my_str: DW \"Hello\" \n" +
".text \n" +
"MOV A, [my_str] \n" +
"brk \n";
TestExecutionResult res = TestHelper.executeCode(code);
assertTrue(res.ar.exceptions.isEmpty());
assertEquals('H', res.regValue("A"));
}
}

View File

@ -14,7 +14,7 @@ public class OrgDirectiveTest {
"ORG 0x8000 \n" +
"my_var: DW 0x1234 \n" +
".text \n" +
"MOV A, my_var \n" +
"MOV A, my_var \n" +
"brk \n";
TestExecutionResult res = TestHelper.executeCode(code);