You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+80-50Lines changed: 80 additions & 50 deletions
Original file line number
Diff line number
Diff line change
@@ -7,38 +7,46 @@
7
7
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.
- Built-in [6502 emulation by Gianluca Ghettini](https://github.com/gianlucag/mos6502) enables stand-alone testing on Linux, etc.
33
36
- 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
+
35
40
- 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
+
37
44
- It comes with many useful evaluation methods found in [the modern UNIT testing frameworks](https://en.wikipedia.org/wiki/List_of_unit_testing_frameworks).
38
45
39
46
## Supported testing feature
40
47
41
48
### Testable program
49
+
42
50
- Test target
43
51
- JSR procedure
44
52
- NMI procedure
@@ -52,38 +60,41 @@ This tool enables [unit testing](https://en.wikipedia.org/wiki/Unit_testing) for
| Check write value history ||:heavy_check_mark:||
66
75
- Evaluate processor information
67
76
- Cycle count
68
77
69
78
### Assertion
79
+
70
80
- 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)
78
88
Representing logical OR operator
79
89
- 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
81
91
- Error handling
82
92
- Write access to readonly memory
83
93
- Access to undefined memory
84
94
- Illegal instruction
85
95
86
96
### Coverage
97
+
87
98
- Testable coverage
88
99
-[LCOV](https://github.com/linux-test-project/lcov) format
89
100
@@ -96,6 +107,7 @@ This tool enables [unit testing](https://en.wikipedia.org/wiki/Unit_testing) for
96
107
## Getting started
97
108
98
109
### Prerequisites
110
+
99
111
This tool is intended for the projects based on [CC65](https://cc65.github.io/).
100
112
101
113
The easiest way to install CC65 on [Ubuntu](https://ubuntu.com/) linux is by running:
@@ -111,8 +123,8 @@ Verified CA65 version:
111
123
ca65 V2.18 - Ubuntu 2.19-1
112
124
```
113
125
114
-
115
126
### Install
127
+
116
128
Since the tool repository has the submodules, the `--recurse-submodules` option must be specified when cloning:
117
129
118
130
```
@@ -125,6 +137,7 @@ Since the tool repository has the submodules, the `--recurse-submodules` option
125
137
### Run example
126
138
127
139
#### Unit testing
140
+
128
141
[Simple example project](https://github.com/AsaiYusuke/6502_test_executor/tree/master/example) includes many test cases that demonstrate the features:
129
142
130
143
```
@@ -143,6 +156,7 @@ All tests passed.
143
156
```
144
157
145
158
#### Coverage
159
+
146
160
When the project is built, the coverage file is saved.
147
161
It is located on `example/coverage/lcov.info` in case of example project.
148
162
@@ -153,7 +167,7 @@ The results of the example project can be seen in [Coveralls](https://coveralls.
153
167
154
168
## Usage
155
169
156
-
```mermaid
170
+
```mermaid
157
171
flowchart LR;
158
172
A(Assembly program);
159
173
C[[CA65]];
@@ -179,24 +193,28 @@ flowchart LR;
179
193
```
180
194
181
195
### 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.
183
198
184
199
### Create unit test
200
+
185
201
Create test scinario files containing the three key items in JSON format:
186
202
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
193
209
194
210
#### JSON Schema file
211
+
195
212
The tool also provides a [JSON Schema](https://json-schema.org/) document that makes it easy to create test scinario files.
196
213
197
214
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.
198
215
199
216
### Run test
217
+
200
218
Run the tool with the prepared debug information file and test scenario file:
201
219
202
220
```
@@ -240,45 +258,54 @@ You can find all command line arguments in help:
240
258
```
241
259
242
260
### Note:
261
+
243
262
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)).
244
263
If both are specified, the values in the test scenario file are adopted.
245
264
246
265
## Test scinario examples
247
266
248
267
### Register conditions
268
+
249
269
-[Check value of A/X/Y registers](https://github.com/AsaiYusuke/6502_test_executor/blob/master/example/test/ok/register.axy.value.test.json)
250
270
-[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)
251
271
-[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)
252
272
-[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)
253
273
-[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)
0 commit comments