Skip to content

Commit 54a0357

Browse files
authored
format README (#12)
1 parent fb4525e commit 54a0357

File tree

1 file changed

+80
-50
lines changed

1 file changed

+80
-50
lines changed

README.md

Lines changed: 80 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -7,38 +7,46 @@
77
This tool enables [unit testing](https://en.wikipedia.org/wiki/Unit_testing) for [MOS Technology 6502](https://en.wikipedia.org/wiki/MOS_Technology_6502) assembly programs on a cross-platform basis.
88

99
## Table of Contents
10-
* [Basic design](#Basic-design)
11-
* [Supported testing feature](#Supported-testing-feature)
12-
* [Testable program](#Testable-program)
13-
* [Condition](#Condition)
14-
* [Assertion](#Assertion)
15-
* [Coverage](#Coverage)
16-
* [Additional useful feature](#Additional-useful-feature)
17-
* [Getting started](#getting-started)
18-
* [Prerequisites](#Prerequisites)
19-
* [Install](#Install)
20-
* [Test example project](#Test-example-project)
21-
* [Unit testing](#Unit-testing)
22-
* [Coverage](#Coverage)
23-
* [Usage](#Usage)
24-
* [Build CA65 project with debug option](#Build-CA65-project-with-debug-option)
25-
* [Create unit test](#Create-unit-test)
26-
* [Run test](#Run-test)
27-
* [Test scinario examples](#Test-scinario-examples)
28-
* [Dependencies](#Dependencies)
10+
11+
- [Basic design](#Basic-design)
12+
- [Supported testing feature](#Supported-testing-feature)
13+
- [Testable program](#Testable-program)
14+
- [Condition](#Condition)
15+
- [Assertion](#Assertion)
16+
- [Coverage](#Coverage)
17+
- [Additional useful feature](#Additional-useful-feature)
18+
- [Getting started](#getting-started)
19+
- [Prerequisites](#Prerequisites)
20+
- [Install](#Install)
21+
- [Test example project](#Test-example-project)
22+
- [Unit testing](#Unit-testing)
23+
- [Coverage](#Coverage)
24+
- [Usage](#Usage)
25+
- [Build CA65 project with debug option](#Build-CA65-project-with-debug-option)
26+
- [Create unit test](#Create-unit-test)
27+
- [Run test](#Run-test)
28+
- [Test scinario examples](#Test-scinario-examples)
29+
- [Dependencies](#Dependencies)
2930

3031
## Basic design
31-
#### *Execute test on built-in emulator*
32+
33+
#### _Execute test on built-in emulator_
34+
3235
- Built-in [6502 emulation by Gianluca Ghettini](https://github.com/gianlucag/mos6502) enables stand-alone testing on Linux, etc.
3336
- No need to add hooks to the product code to invoke test.
34-
#### *Write test with JSON Schema*
37+
38+
#### _Write test with JSON Schema_
39+
3540
- The tool provides [JSON Schema](https://json-schema.org/) document that makes it easy to create test.
36-
#### *Evaluate test like modern frameworks*
41+
42+
#### _Evaluate test like modern frameworks_
43+
3744
- It comes with many useful evaluation methods found in [the modern UNIT testing frameworks](https://en.wikipedia.org/wiki/List_of_unit_testing_frameworks).
3845

3946
## Supported testing feature
4047

4148
### Testable program
49+
4250
- Test target
4351
- JSR procedure
4452
- NMI procedure
@@ -52,38 +60,41 @@ This tool enables [unit testing](https://en.wikipedia.org/wiki/Unit_testing) for
5260
- JMP
5361

5462
### Condition
63+
5564
- Setup device conditions before test
56-
| | Register | Memory | Stack |
65+
| | Register | Memory | Stack |
5766
| :---------------------- | :----------------: | :----------------: | :----------------: |
58-
| Set value | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
59-
| Mock read value history | | :heavy_check_mark: | |
67+
| Set value | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
68+
| Mock read value history | | :heavy_check_mark: | |
6069
- Evaluate device conditions after test
61-
| | Register | Memory | Stack |
70+
| | Register | Memory | Stack |
6271
| :------------------------ | :----------------: | :----------------: | :----------------: |
63-
| Check value | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
64-
| Check read/write count | :heavy_check_mark: | :heavy_check_mark: | |
65-
| Check write value history | | :heavy_check_mark: | |
72+
| Check value | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
73+
| Check read/write count | :heavy_check_mark: | :heavy_check_mark: | |
74+
| Check write value history | | :heavy_check_mark: | |
6675
- Evaluate processor information
6776
- Cycle count
6877

6978
### Assertion
79+
7080
- Assertion operator how test is evaluated
71-
- *"eq"* (Equal to)
72-
- *"ne"* (Not equal to)
73-
- *"gt"* (Greater than)
74-
- *"ge"* (Greater than or equal to)
75-
- *"lt"* (Less than)
76-
- *"le"* (Less than or equal to)
77-
- *"anyOf"* (Any of)
81+
- _"eq"_ (Equal to)
82+
- _"ne"_ (Not equal to)
83+
- _"gt"_ (Greater than)
84+
- _"ge"_ (Greater than or equal to)
85+
- _"lt"_ (Less than)
86+
- _"le"_ (Less than or equal to)
87+
- _"anyOf"_ (Any of)
7888
Representing logical OR operator
7989
- Composite operators
80-
Same as logical AND operator. e.g. "*gt*"+"*lt*" for range selection
90+
Same as logical AND operator. e.g. "_gt_"+"_lt_" for range selection
8191
- Error handling
8292
- Write access to readonly memory
8393
- Access to undefined memory
8494
- Illegal instruction
8595

8696
### Coverage
97+
8798
- Testable coverage
8899
- [LCOV](https://github.com/linux-test-project/lcov) format
89100

@@ -96,6 +107,7 @@ This tool enables [unit testing](https://en.wikipedia.org/wiki/Unit_testing) for
96107
## Getting started
97108

98109
### Prerequisites
110+
99111
This tool is intended for the projects based on [CC65](https://cc65.github.io/).
100112

101113
The easiest way to install CC65 on [Ubuntu](https://ubuntu.com/) linux is by running:
@@ -111,8 +123,8 @@ Verified CA65 version:
111123
ca65 V2.18 - Ubuntu 2.19-1
112124
```
113125

114-
115126
### Install
127+
116128
Since the tool repository has the submodules, the `--recurse-submodules` option must be specified when cloning:
117129

118130
```
@@ -125,6 +137,7 @@ Since the tool repository has the submodules, the `--recurse-submodules` option
125137
### Run example
126138

127139
#### Unit testing
140+
128141
[Simple example project](https://github.com/AsaiYusuke/6502_test_executor/tree/master/example) includes many test cases that demonstrate the features:
129142

130143
```
@@ -143,6 +156,7 @@ All tests passed.
143156
```
144157

145158
#### Coverage
159+
146160
When the project is built, the coverage file is saved.
147161
It is located on `example/coverage/lcov.info` in case of example project.
148162

@@ -153,7 +167,7 @@ The results of the example project can be seen in [Coveralls](https://coveralls.
153167

154168
## Usage
155169

156-
``` mermaid
170+
```mermaid
157171
flowchart LR;
158172
A(Assembly program);
159173
C[[CA65]];
@@ -179,24 +193,28 @@ flowchart LR;
179193
```
180194

181195
### Build CA65 project with debug option
182-
Build your 6502 project using [CA65 assembler](https://cc65.github.io/doc/ca65.html)/[LD65 linker](https://cc65.github.io/doc/ld65.html) with *debug information generation* enabled.
196+
197+
Build your 6502 project using [CA65 assembler](https://cc65.github.io/doc/ca65.html)/[LD65 linker](https://cc65.github.io/doc/ld65.html) with _debug information generation_ enabled.
183198

184199
### Create unit test
200+
185201
Create test scinario files containing the three key items in JSON format:
186202

187-
- *Test target*
188-
the starting address of the test procedure
189-
- *Setup condition*
190-
the settings of the register and memory to make before the test
191-
- *Expected condition*
192-
the expected responses of the register and memory after the test
203+
- _Test target_
204+
the starting address of the test procedure
205+
- _Setup condition_
206+
the settings of the register and memory to make before the test
207+
- _Expected condition_
208+
the expected responses of the register and memory after the test
193209

194210
#### JSON Schema file
211+
195212
The tool also provides a [JSON Schema](https://json-schema.org/) document that makes it easy to create test scinario files.
196213

197214
If you use [Visual Studio Code](https://code.visualstudio.com/), it will tell you about formatting error and element completion candidates based on JSON Schema without any extensions.
198215

199216
### Run test
217+
200218
Run the tool with the prepared debug information file and test scenario file:
201219

202220
```
@@ -240,45 +258,54 @@ You can find all command line arguments in help:
240258
```
241259

242260
### Note:
261+
243262
Some options can be specified either as command line arguments or test scenario file ([See example](https://github.com/AsaiYusuke/6502_test_executor/blob/master/example/test/ok/customize.configurations.test.json)).
244263
If both are specified, the values in the test scenario file are adopted.
245264

246265
## Test scinario examples
247266

248267
### Register conditions
268+
249269
- [Check value of A/X/Y registers](https://github.com/AsaiYusuke/6502_test_executor/blob/master/example/test/ok/register.axy.value.test.json)
250270
- [Check read/write count of A/X/Y registers](https://github.com/AsaiYusuke/6502_test_executor/blob/master/example/test/ok/register.axy.count.test.json)
251271
- [Check value of Processor status register flags](https://github.com/AsaiYusuke/6502_test_executor/blob/master/example/test/ok/register.status.flag.value.test.json)
252272
- [Check read/write count of Processor status register flags](https://github.com/AsaiYusuke/6502_test_executor/blob/master/example/test/ok/register.status.flag.count.test.json)
253273
- [Check machine when PC register arrives at a specific address](https://github.com/AsaiYusuke/6502_test_executor/blob/master/example/test/ok/init.code.test.json)
274+
254275
### Memory conditions
276+
255277
- [Memory addressing](https://github.com/AsaiYusuke/6502_test_executor/blob/master/example/test/ok/memory.addressing.test.json)
256278
- [Check value of memory](https://github.com/AsaiYusuke/6502_test_executor/blob/master/example/test/ok/memory.value.check.test.json)
257279
- [Check read/write count of memory](https://github.com/AsaiYusuke/6502_test_executor/blob/master/example/test/ok/memory.count.check.test.json)
258280
- [Batch selection of continuous memory area](https://github.com/AsaiYusuke/6502_test_executor/blob/master/example/test/ok/memory.contiguous.memory.area.test.json)
259281
- [Sequential change value](https://github.com/AsaiYusuke/6502_test_executor/blob/master/example/test/ok/memory.sequential.change.value.test.json)
260282

261283
### Stack conditions
284+
262285
- [Check value of stack](https://github.com/AsaiYusuke/6502_test_executor/blob/master/example/test/ok/stack.value.check.test.json)
263286
- [rts to caller](https://github.com/AsaiYusuke/6502_test_executor/blob/master/example/test/ok/stack.rts.check.test.json)
264287

265288
### Processor conditions
289+
266290
- [Cycle count information](https://github.com/AsaiYusuke/6502_test_executor/blob/master/example/test/ok/error.timeout.test.json)
267291
- [Interrupt hooks](https://github.com/AsaiYusuke/6502_test_executor/blob/master/example/test/ok/interrupt.test.json)
268292
- [Call mocked proc](https://github.com/AsaiYusuke/6502_test_executor/blob/master/example/test/ok/mock.proc.test.json)
269293

270294
### Testable procedures
271-
- [JSR proc](https://github.com/AsaiYusuke/6502_test_executor/blob/master/example/test/ok/test_type/jsr.test.json)
272-
- [NMI proc](https://github.com/AsaiYusuke/6502_test_executor/blob/master/example/test/ok/test_type/nmi.test.json)
273-
- [IRQ proc](https://github.com/AsaiYusuke/6502_test_executor/blob/master/example/test/ok/test_type/irq.test.json)
274-
- [Address range](https://github.com/AsaiYusuke/6502_test_executor/blob/master/example/test/ok/test_type/address.test.json)
295+
296+
- [JSR proc](https://github.com/AsaiYusuke/6502_test_executor/blob/master/example/test/ok/test_type/jsr.test.json)
297+
- [NMI proc](https://github.com/AsaiYusuke/6502_test_executor/blob/master/example/test/ok/test_type/nmi.test.json)
298+
- [IRQ proc](https://github.com/AsaiYusuke/6502_test_executor/blob/master/example/test/ok/test_type/irq.test.json)
299+
- [Address range](https://github.com/AsaiYusuke/6502_test_executor/blob/master/example/test/ok/test_type/address.test.json)
275300

276301
### Error handling
302+
277303
- [Write to readonly memory](https://github.com/AsaiYusuke/6502_test_executor/blob/master/example/test/fail/error.readonly.test.json)
278304
- [Access to out of segment](https://github.com/AsaiYusuke/6502_test_executor/blob/master/example/test/fail/error.out_of_segment.test.json)
279305
- [Illegal instruction](https://github.com/AsaiYusuke/6502_test_executor/blob/master/example/test/fail/error.illegal_instruction.test.json)
280306

281307
### Misc
308+
282309
- [Customize configurations](https://github.com/AsaiYusuke/6502_test_executor/blob/master/example/test/ok/customize.configurations.test.json)
283310
- [Skip test (ignore)](https://github.com/AsaiYusuke/6502_test_executor/blob/master/example/test/ok/skip.test.json)
284311
- [Complex evaluation](https://github.com/AsaiYusuke/6502_test_executor/blob/master/example/test/ok/evaluation.test.json)
@@ -287,11 +314,14 @@ If both are specified, the values in the test scenario file are adopted.
287314
- [Definitions](https://github.com/AsaiYusuke/6502_test_executor/blob/master/example/test/ok/definitions.test.json)
288315

289316
## Dependencies
317+
290318
This project uses following project:
319+
291320
- [Gianluca Ghettini's 6502 emulator](https://github.com/gianlucag/mos6502)
292321
- [Erik Lothe's 6502 Unit test executor](https://github.com/89erik/6502_test_executor)
293322
- [Taylor C. Richberger's args](https://github.com/Taywee/args)
294323
- [Niels Lohmann's JSON for Modern C++](https://github.com/nlohmann/json)
295324

296325
## License
326+
297327
This project is available under the **MIT license**. See the [LICENSE](LICENSE) file for more information.

0 commit comments

Comments
 (0)