From 4afe956113f69d01ff7f3f0c622de0894ccf407d Mon Sep 17 00:00:00 2001 From: Dan <46821332+nsadeveloper789@users.noreply.github.com> Date: Mon, 23 May 2022 09:19:55 -0400 Subject: [PATCH] GP-0: Fix tests: Removed parens for const:size --- .../struct/sub/StructuredSleighTest.java | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/Ghidra/Debug/ProposedUtils/src/test/java/ghidra/pcode/struct/sub/StructuredSleighTest.java b/Ghidra/Debug/ProposedUtils/src/test/java/ghidra/pcode/struct/sub/StructuredSleighTest.java index 8ff1f351e0..a9f1b8f0fc 100644 --- a/Ghidra/Debug/ProposedUtils/src/test/java/ghidra/pcode/struct/sub/StructuredSleighTest.java +++ b/Ghidra/Debug/ProposedUtils/src/test/java/ghidra/pcode/struct/sub/StructuredSleighTest.java @@ -65,7 +65,7 @@ public class StructuredSleighTest extends AbstractGhidraHeadlessIntegrationTest } }; SleighPcodeUseropDefinition myUserop = ss.generate().get("my_userop"); - assertEquals(List.of("__op_output = (param_1 * (0x2:4));\n"), myUserop.getLines()); + assertEquals(List.of("__op_output = (param_1 * 0x2:4);\n"), myUserop.getLines()); } @Test(expected = SleighException.class) @@ -90,7 +90,7 @@ public class StructuredSleighTest extends AbstractGhidraHeadlessIntegrationTest } }; SleighPcodeUseropDefinition myUserop = ss.generate().get("my_userop"); - assertEquals(List.of("__op_output = (r0 * (0x2:4));\n"), myUserop.getLines()); + assertEquals(List.of("__op_output = (r0 * 0x2:4);\n"), myUserop.getLines()); } @Test @@ -105,7 +105,7 @@ public class StructuredSleighTest extends AbstractGhidraHeadlessIntegrationTest SleighPcodeUseropDefinition myUserop = ss.generate().get("my_userop"); assertEquals(List.of("" + "local my_var:4;\n" + - "__op_output = (my_var * (0x2:4));\n"), + "__op_output = (my_var * 0x2:4);\n"), myUserop.getLines()); // Verify the source compiles myUserop.programFor(new Varnode(r0.getAddress(), r0.getNumBytes()), List.of(), @@ -138,11 +138,11 @@ public class StructuredSleighTest extends AbstractGhidraHeadlessIntegrationTest }; SleighPcodeUseropDefinition myUserop = ss.generate().get("my_userop"); assertEquals(List.of("" + - "if (0x1:1) goto ;\n" + - "tmp = (0x2:4);\n" + + "if 0x1:1 goto ;\n" + + "tmp = 0x2:4;\n" + "goto ;\n" + "\n" + - "tmp = (0x1:4);\n" + + "tmp = 0x1:4;\n" + "\n"), myUserop.getLines()); } @@ -159,8 +159,8 @@ public class StructuredSleighTest extends AbstractGhidraHeadlessIntegrationTest }; SleighPcodeUseropDefinition myUserop = ss.generate().get("my_userop"); assertEquals(List.of("" + - "if (!(0x1:1)) goto ;\n" + - "tmp = (0x1:4);\n" + + "if (!0x1:1) goto ;\n" + + "tmp = 0x1:4;\n" + "\n"), myUserop.getLines()); } @@ -181,11 +181,11 @@ public class StructuredSleighTest extends AbstractGhidraHeadlessIntegrationTest SleighPcodeUseropDefinition myUserop = ss.generate().get("my_userop"); assertEquals(List.of("" + "local i:4;\n" + "local sum:4;\n" + - "i = (0x0:4);\n" + + "i = 0x0:4;\n" + "\n" + "if (i >= n) goto ;\n" + "sum = (sum + i);\n" + - "i = (i + (0x1:4));\n" + + "i = (i + 0x1:4);\n" + "goto ;\n" + "\n" + "__op_output = sum;\n"), @@ -212,12 +212,12 @@ public class StructuredSleighTest extends AbstractGhidraHeadlessIntegrationTest assertEquals(List.of("" + "local i:4;\n" + "local sum:4;\n" + - "i = (0x0:4);\n" + + "i = 0x0:4;\n" + "\n" + "if (i >= n) goto ;\n" + "sum = (sum + i);\n" + - "if (sum >= (0x3e8:4)) goto ;\n" + - "i = (i + (0x1:4));\n" + + "if (sum >= 0x3e8:4) goto ;\n" + + "i = (i + 0x1:4);\n" + "goto ;\n" + "\n" + "__op_output = sum;\n"), @@ -233,7 +233,7 @@ public class StructuredSleighTest extends AbstractGhidraHeadlessIntegrationTest } }; SleighPcodeUseropDefinition myUserop = ss.generate().get("my_userop"); - assertEquals(List.of("return (* (0xdeadbeef:8));\n"), myUserop.getLines()); + assertEquals(List.of("return (* 0xdeadbeef:8);\n"), myUserop.getLines()); // TODO: Test that the generated code compiles in a slaspec file. // It's rejected for injects because "return" is not valid there. }