Skip to content

Commit 37710e5

Browse files
authored
project-wide configuration (#41)
1 parent f2c587e commit 37710e5

11 files changed

+343
-257
lines changed

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,9 @@ If both are specified, the values in the test scenario file are adopted.
320320
- [Customize configurations](https://github.com/AsaiYusuke/6502_test_executor/blob/master/example/test/ok/customize.configurations.test.json)
321321
- [Skip test (ignore)](https://github.com/AsaiYusuke/6502_test_executor/blob/master/example/test/ok/skip.test.json)
322322
- [Complex evaluation](https://github.com/AsaiYusuke/6502_test_executor/blob/master/example/test/ok/evaluation.test.json)
323-
- [Project for tests](https://github.com/AsaiYusuke/6502_test_executor/blob/master/example/test/ok/project/project.test.json)
323+
- [Project-wide test set](https://github.com/AsaiYusuke/6502_test_executor/blob/master/example/test/ok/project/project.test.json)
324+
- [Project-wide configuration](https://github.com/AsaiYusuke/6502_test_executor/blob/master/example/test/fail/200/project/error.out_of_segment.test.json)
325+
- [Override from project-wide configuration](https://github.com/AsaiYusuke/6502_test_executor/blob/master/example/test/ok/project/merge_config.test.json)
324326
- [Grouping](https://github.com/AsaiYusuke/6502_test_executor/blob/master/example/test/ok/group.test.json)
325327
- [Definitions](https://github.com/AsaiYusuke/6502_test_executor/blob/master/example/test/ok/definitions.test.json)
326328

example/test/fail/200/error.out_of_segment.test.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@
88
"testCases": {
99
"out of segment test": {
1010
"$comment": [
11-
"The `write_out_of_segment` proc executes sta in the undefined memory at address `$7fff`.",
12-
"Since `ACCESS_TO_OUT_OF_SEGMENT` is activated,",
13-
"attempting to write to such undefined memory terminates test with an error."
11+
"The `write_out_of_segment` proc executes sta on undefined memory at address `$7fff`.",
12+
"Since `ACCESS_TO_OUT_OF_SEGMENT` is active,",
13+
"writing to such undefined memory terminates test with an error."
1414
],
1515
"setup": {},
1616
"expected": {}

example/test/fail/200/error.readonly.test.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
"write readonly memory test": {
1010
"$comment": [
1111
"The `write_rodata` proc executes `sta` in readonly memory at address with `vector_dic` label.",
12-
"Since `WRITE_TO_READONLY_MEMORY` is activated,",
13-
"attempting to write to such readonly memory terminates test with an error."
12+
"Since `WRITE_TO_READONLY_MEMORY` is active,",
13+
"writing to such readonly memory terminates test with an error."
1414
],
1515
"setup": {},
1616
"expected": {}

example/test/fail/200/error.unauthorized_memory_access.test.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"Unauthorized access test": {
1010
"$comment": [
1111
"The `unauthorized_access` proc executes two `lda`.",
12-
"Since `ACCESS_TO_UNAUTHORIZED_MEMORY` is activated",
12+
"Since `ACCESS_TO_UNAUTHORIZED_MEMORY` is active",
1313
"and the addresses in `ZEROPAGE` segment indicated in `authorizedList` are authorized for data access,",
1414
"1st `lda` succeeds as it accesses an authorized address,",
1515
"but 2nd `lda` terminates test with an error."

example/test/fail/200/error.uninitialized_memory_read.test.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
"The `uninitialized_read` proc executes two `lda`.",
1212
"1st `lda` is from initialized `pos` address.",
1313
"2nd `lda` is from uninitialized `pos+1` address.",
14-
"Since `READ_FROM_UNINITIALIZED_MEMORY` is activated,",
14+
"Since `READ_FROM_UNINITIALIZED_MEMORY` is active,",
1515
"2nd `lda` terminates test with an error."
1616
],
1717
"setup": {
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
{
2+
"$schema": "../../../../../schema/project.schema.json",
3+
"config": {
4+
"testMemoryAccess": {
5+
"feature": [
6+
"ACCESS_TO_OUT_OF_SEGMENT"
7+
]
8+
}
9+
},
10+
"tests": [
11+
{
12+
"target": {
13+
"start": {
14+
"label": "write_out_of_segment"
15+
}
16+
},
17+
"testCases": {
18+
"out of segment test": {
19+
"$comment": [
20+
"Same as example/test/fail/200/error.out_of_segment.test.json.",
21+
"The `write_out_of_segment` proc executes sta in the undefined memory at address `$7fff`.",
22+
"Since `ACCESS_TO_OUT_OF_SEGMENT` is active,",
23+
"writing to such undefined memory terminates test with an error."
24+
],
25+
"setup": {},
26+
"expected": {}
27+
}
28+
}
29+
}
30+
]
31+
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
{
2+
"$schema": "../../../../schema/project.schema.json",
3+
"config": {
4+
"maxCycleCount": 1,
5+
"testMemoryAccess": {
6+
"feature": [
7+
"ACCESS_TO_OUT_OF_SEGMENT"
8+
]
9+
}
10+
},
11+
"tests": [
12+
{
13+
"config": {
14+
"maxCycleCount": 10000,
15+
"testMemoryAccess": {
16+
"feature": []
17+
}
18+
},
19+
"target": {
20+
"start": {
21+
"label": "write_out_of_segment"
22+
}
23+
},
24+
"testCases": {
25+
"success out of segment test": {
26+
"$comment": [
27+
"The `write_out_of_segment` proc executes sta on undefined memory at address $7fff.",
28+
"Since `ACCESS_TO_OUT_OF_SEGMENT` is inactive (overrided),",
29+
"writing to such undefined memory results in a successful completion without any errors."
30+
],
31+
"setup": {},
32+
"expected": {}
33+
}
34+
}
35+
}
36+
]
37+
}

include/test/test.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ class test
1717
{
1818
private:
1919
args_parser *args;
20+
json config;
2021
debug_info *debug;
2122
emulation_devices *device;
2223
vector<json> test_scenarios;

schema/project.schema.json

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,14 @@
3333
{
3434
"$ref": "testcase.schema.json"
3535
}
36-
]
36+
],
37+
"properties": {
38+
"config": {
39+
"properties": {
40+
"debugFile": false
41+
}
42+
}
43+
}
3744
},
3845
"else": {
3946
"properties": {
@@ -44,6 +51,9 @@
4451
}
4552
}
4653
}
54+
},
55+
"config": {
56+
"$ref": "testcase.schema.json#/definitions/config"
4757
}
4858
}
4959
}

0 commit comments

Comments
 (0)