mirror of
https://github.com/WerWolv/ImHex-Patterns.git
synced 2026-03-27 23:37:04 -05:00
tests: Added tests for constants and tips checking
This commit is contained in:
15
.github/workflows/tests.yml
vendored
15
.github/workflows/tests.yml
vendored
@@ -33,6 +33,10 @@ jobs:
|
||||
${PKGCONF:-} \
|
||||
cmake \
|
||||
make \
|
||||
python3 \
|
||||
python3-pip
|
||||
|
||||
sudo pip install jsonschema
|
||||
|
||||
- name: 🛠️ Build
|
||||
run: |
|
||||
@@ -49,4 +53,13 @@ jobs:
|
||||
- name: 🧪 Perform Unit Tests
|
||||
run: |
|
||||
cd tests/build
|
||||
ctest
|
||||
ctest
|
||||
- name: 📎 Validate JSON Files
|
||||
run: |
|
||||
cd constants
|
||||
for file in ./[!_schema.json]*; do jsonschema -i $file _schema.json; done
|
||||
cd ..
|
||||
|
||||
cd tips
|
||||
for file in ./[!_schema.json]*; do jsonschema -i $file _schema.json; done
|
||||
cd ..
|
||||
|
||||
73
constants/_schema.json
Normal file
73
constants/_schema.json
Normal file
@@ -0,0 +1,73 @@
|
||||
{
|
||||
"definitions": {},
|
||||
"$schema": "http://json-schema.org/draft-07/schema#",
|
||||
"$id": "https://example.com/object1655988398.json",
|
||||
"title": "Root",
|
||||
"type": "object",
|
||||
"required": [
|
||||
"name",
|
||||
"values"
|
||||
],
|
||||
"properties": {
|
||||
"name": {
|
||||
"$id": "#root/name",
|
||||
"title": "Name",
|
||||
"type": "string",
|
||||
"default": "",
|
||||
"examples": [
|
||||
"Group description"
|
||||
],
|
||||
"pattern": "^.*$"
|
||||
},
|
||||
"values": {
|
||||
"$id": "#root/values",
|
||||
"title": "Values",
|
||||
"type": "array",
|
||||
"default": [],
|
||||
"items":{
|
||||
"$id": "#root/values/items",
|
||||
"title": "Items",
|
||||
"type": "object",
|
||||
"required": [
|
||||
"type",
|
||||
"value",
|
||||
"name"
|
||||
],
|
||||
"properties": {
|
||||
"type": {
|
||||
"$id": "#root/values/items/type",
|
||||
"title": "Type",
|
||||
"type": "string",
|
||||
"default": "",
|
||||
"examples": [
|
||||
"int16be",
|
||||
"int16le",
|
||||
"int10"
|
||||
],
|
||||
"pattern": "^(int10|int16le|int16be)$"
|
||||
},
|
||||
"value": {
|
||||
"$id": "#root/values/items/value",
|
||||
"title": "Value",
|
||||
"type": "string",
|
||||
"default": "",
|
||||
"examples": [
|
||||
"ACDC"
|
||||
],
|
||||
"pattern": "^([0-9a-fA-F]+)$"
|
||||
},
|
||||
"name": {
|
||||
"$id": "#root/values/items/name",
|
||||
"title": "Name",
|
||||
"type": "string",
|
||||
"default": "",
|
||||
"examples": [
|
||||
"Constant description"
|
||||
],
|
||||
"pattern": "^.*$"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -128,7 +128,7 @@
|
||||
},
|
||||
{
|
||||
"type": "int10",
|
||||
"value": "402 ",
|
||||
"value": "402",
|
||||
"name": "Payment Required"
|
||||
},
|
||||
{
|
||||
|
||||
39
tips/_schema.json
Normal file
39
tips/_schema.json
Normal file
@@ -0,0 +1,39 @@
|
||||
{
|
||||
"definitions": {},
|
||||
"$schema": "http://json-schema.org/draft-07/schema#",
|
||||
"$id": "https://example.com/object1655988771.json",
|
||||
"title": "Root",
|
||||
"type": "object",
|
||||
"required": [
|
||||
"name",
|
||||
"tips"
|
||||
],
|
||||
"properties": {
|
||||
"name": {
|
||||
"$id": "#root/name",
|
||||
"title": "Name",
|
||||
"type": "string",
|
||||
"default": "",
|
||||
"examples": [
|
||||
"Tips category"
|
||||
],
|
||||
"pattern": "^.*$"
|
||||
},
|
||||
"tips": {
|
||||
"$id": "#root/tips",
|
||||
"title": "Tips",
|
||||
"type": "array",
|
||||
"default": [],
|
||||
"items":{
|
||||
"$id": "#root/tips/items",
|
||||
"title": "Items",
|
||||
"type": "string",
|
||||
"default": "",
|
||||
"examples": [
|
||||
"Some interesting tip"
|
||||
],
|
||||
"pattern": "^.*$"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user