Download the PHP package lhsazevedo/sh4objtest without Composer
On this page you can find all versions of the php package lhsazevedo/sh4objtest. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package sh4objtest
Hitachi SH4 Object Tester
The Hitachi SH4 Object Tester is a specialized simulator and testing framework developed to support the Tokyo Bus Guide decompilation project. This tool enables developers to run and validate SH4 object files using a suite of predefined expectations and test cases.
[!NOTE]
This project is in active development and may contain breaking changes.
Features
- Simulates Hitachi SH4 object code execution
- Provides a framework for writing and running test cases
- Supports memory allocation and initialization
- Allows mocking of function calls and return values
- Enables verification of memory writes and function calls
Usage
To use the Hitachi SH4 Object Tester, you need to write test cases that define the initial state, expected behavior, and assertions for your SH4 object code. Let's say that we want to test the following function:
This C function reads a value from the memory location pointed to by ptr
, calls someFunction
with that value, and then writes the result back to the same memory location.
Here's a basic example of how to structure a test case for this function:
This example demonstrates how to:
- Allocate and initialize memory
- Set expectations for function calls
- Set expectations for memory writes
- Run the function under test
Note that all expectations are defined before calling run()
. There are no assertions after the
function execution.
To run the test case, you need to execute the following command:
Sh4objtest will load the object file, execute the test case, and report the results:
Documentation
Comprehensive documentation for this project is still in development. In the meantime, please refer to the test cases in the Tokyo Bus Guide decompilation project for practical examples of how to write tests using this framework.