From 1144a2a750e71b585c010b127cec466d8366001b Mon Sep 17 00:00:00 2001 From: wgroeneveld Date: Wed, 5 Dec 2018 09:47:45 +0100 Subject: [PATCH] update readme --- README.md | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 58fae6b..ac53f65 100644 --- a/README.md +++ b/README.md @@ -11,10 +11,33 @@ from opbtest import OpbTestCase class MyTestCase(OpbTestCase): def test_my_cool_procedure_should_set_some_register(self): - assert_that = self.load_file("functions.psm4").testproc("my_cool_procedure").execute() + assert_that = self.load_file("functions.psm4")\ + .testproc("add_registers")\ + .setregs({"s0": 1, "s1": 2})\ + .execute() assert_that.reg("s5").contains(3) ```` +Given the following Assembly: + +``` +jump main +proc add_registers(s0 is one, s1 is two, s5 is result) { + load result, 0 + loop1: + add result, 1 + sub one, 1 + jump NZ, loop1 + loop2: + add result, 1 + sub two, 1 + jump NZ, loop2 +} +main: + ; this should not be executed + load result, 42 +``` + That's it! Load your Assembly file, apply setup (mocks, inputs), and verify expectations. opbtest relies on [opbasm and opbsim](https://kevinpt.github.io/opbasm) to compile and evaluate your code.