Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update spec -- corrected several tests and update JSON regex for value validation #195

Merged
merged 4 commits into from
Sep 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ jobs:
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: Print Node.js version and CI environment
run: |
echo "Node.js version: $(node -v)"
echo "Environment: CI=${{ env.CI }}"
- name: Download dependencies
run: npm ci
- name: Test with Node.js ${{ matrix.node-version }}
Expand Down
239 changes: 79 additions & 160 deletions spec_tests/javascript_tests.json → spec_tests/javascriptTests.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"name": "character-invalid-non-printing appears",
"description": "The HED string contains a UTF-8 character.",
"warning": false,
"schema": "8.2.0",
"schema": "8.3.0",
"definitions": ["(Definition/Acc/#, (Acceleration/#, Red))", "(Definition/MyColor, (Label/Pie))"],
"tests": {
"string_tests": {
Expand All @@ -26,7 +26,7 @@
{
"event_code": {
"HED": {
"show": "Red, Label/a \u00ca\u00b0 good"
"show": "Red, Label/a-\u00ca\u00b0-good"
}
}
}
Expand All @@ -42,7 +42,7 @@
"passes": [
[
["onset", "duration", "HED"],
[4.5, 0, "Label/Temp, Label/a \u00ca\u00b0 good"]
[4.5, 0, "Label/Temp, Label/a-\u00ca\u00b0-good"]
]
]
},
Expand Down Expand Up @@ -134,7 +134,7 @@
"error_code": "CHARACTER_INVALID",
"alt_codes": ["TAG_INVALID", "VALUE_INVALID"],
"name": "invalid-character-name-value-class",
"description": "An invalid character was used in an 8.3.0 or greater style text value class.",
"description": "An invalid character was used in an 8.3.0 or greater style name value class.",
"warning": false,
"schema": "8.3.0",
"definitions": ["(Definition/Acc/#, (Acceleration/#, Red))", "(Definition/MyColor, (Label/Pie))"],
Expand Down Expand Up @@ -165,11 +165,11 @@
"fails": [
[
["onset", "duration", "HED"],
[4.5, 0, "Statistical-accuracy/1max1"]
[4.5, 0, "Label/%max1"]
],
[
["onset", "duration", "HED"],
[4.5, 0, "Label/30$"]
[4.5, 0, "Label/$30"]
],
[
["onset", "duration", "HED"],
Expand Down Expand Up @@ -230,67 +230,6 @@
}
}
},
{
"error_code": "CHARACTER_INVALID",
"alt_codes": ["UNITS_INVALID"],
"name": "invalid-character-numeric-class",
"description": "An invalid character was used in an 8.3.0 or greater style numeric value class.",
"warning": false,
"schema": "8.3.0",
"definitions": [],
"tests": {
"string_tests": {
"fails": [
"Weight/3.0$ kg",
"Weight/3.0db kg",
"Weight/3.0& kg",
"Weight/abc kg",
"Weight/*3.0 kg",
"Weight/3.0% kg",
"Weight/3.0^ kg",
"Weight/3.0? kg"
],
"passes": [
"Weight/3.0e10 kg",
"Weight/3e10 kg",
"Weight/3.0 kg",
"Weight/3000 kg",
"Weight/3e10 kg",
"Weight/3.5e10 kg",
"Weight/2.998e8 g",
"Weight/6.022e23 g",
"Weight/7.0e-10 g",
"Weight/1.6e-35 kg"
]
},
"sidecar_tests": {
"fails": [
{
"event_code": {
"HED": {
"show": "Weight/3.0a"
}
}
}
],
"passes": [
{
"event_code": {
"HED": "Weight/# g"
}
}
]
},
"event_tests": {
"fails": [],
"passes": []
},
"combo_tests": {
"fails": [],
"passes": []
}
}
},
{
"error_code": "COMMA_MISSING",
"alt_codes": [],
Expand Down Expand Up @@ -2521,7 +2460,7 @@
"fails": [
{
"trial": {
"HED": "Def/Acc/# m-per-s^2, Label/#"
"HED": "Def/Acc/#, Label/#"
},
"memory": {
"HED": "Blue, Red, Label/#"
Expand All @@ -2531,7 +2470,7 @@
"passes": [
{
"trial": {
"HED": "Def/Acc/# m-per-s^2"
"HED": "Def/Acc/#"
}
}
]
Expand Down Expand Up @@ -2708,7 +2647,7 @@
},
{
"error_code": "SIDECAR_BRACES_INVALID",
"alt_codes": ["CHARACTER_INVALID"],
"alt_codes": ["CHARACTER_INVALID", "SIDECAR_INVALID"],
"name": "sidecar-braces-contents-invalid",
"description": "The item in curly braces is not the word HED or a column name with HED annotations in the sidecar.",
"warning": false,
Expand Down Expand Up @@ -2804,7 +2743,7 @@
},
{
"error_code": "SIDECAR_BRACES_INVALID",
"alt_codes": ["VALUE_INVALID", "CHARACTER_INVALID", "UNITS_INVALID"],
"alt_codes": ["VALUE_INVALID", "CHARACTER_INVALID", "UNITS_INVALID", "DEF_INVALID"],
"name": "sidecar-braces-invalid-spot",
"description": "A curly brace reference must only appear where a tag could.",
"warning": false,
Expand All @@ -2821,7 +2760,7 @@
"event_code": {
"HED": {
"face": "(Red, Blue), (Green, (Yellow))",
"ball": "(Def/Acc/{response_time})"
"ball": "(Label/{response_time})"
}
},
"response_time": {
Expand Down Expand Up @@ -2948,7 +2887,7 @@
},
"response_time": {
"Description": "Has description with HED",
"HED": "Label/#"
"HED": "Parameter-value/#"
}
},
"events": [
Expand Down Expand Up @@ -2986,7 +2925,7 @@
}
},
"response_time": {
"HED": "Label/#, {response_time}"
"HED": "Parameter-value/#, {response_time}"
}
}
],
Expand All @@ -3000,7 +2939,7 @@
},
"response_time": {
"Description": "Has description with HED",
"HED": "Label/#"
"HED": "Parameter-value/#"
},
"response_count": {
"Description": "A count used to test curly braces in value columns.",
Expand All @@ -3016,7 +2955,7 @@
},
"response_action": {
"Description": "Does not correspond to curly braces",
"HED": "Label/#"
"HED": "Parameter-value/#"
}
}
]
Expand All @@ -3037,7 +2976,7 @@
},
"response_time": {
"Description": "Has description with HED",
"HED": "Label/#, {response_time}"
"HED": "Parameter-value/#, {response_time}"
}
},
"events": [
Expand All @@ -3060,7 +2999,7 @@
},
"response_time": {
"Description": "Has description with HED",
"HED": "Label/#"
"HED": "Parameter-value/#"
}
},
"events": [
Expand Down Expand Up @@ -3361,87 +3300,6 @@
}
}
},
{
"error_code": "SIDECAR_INVALID",
"alt_codes": [],
"name": "curly-braces-has-no-hed",
"description": "A column name appears in curly braces, but that column name does not have a HED annotation.",
"warning": false,
"schema": "8.3.0",
"definitions": ["(Definition/Acc/#, (Acceleration/#, Red))", "(Definition/MyColor, (Label/Pie))"],
"tests": {
"string_tests": {
"fails": [],
"passes": []
},
"sidecar_tests": {
"fails": [
{
"event_code": {
"HED": {
"face": "Statistical-accuracy/0.677, {response}"
}
},
"response": {
"Description": "This is a response"
}
}
],
"passes": [
{
"event_code": {
"HED": {
"face": "Statistical-accuracy/0.677, {response}"
}
},
"response": {
"HED": "Label/#"
}
}
]
},
"event_tests": {
"fails": [],
"passes": []
},
"combo_tests": {
"fails": [
{
"sidecar": {
"event_code": {
"HED": {
"face": "Statistical-accuracy/0.677, {response}"
}
},
"response": "This is a response"
},
"events": [
["onset", "duration", "event_code", "response", "HED"],
[4.5, 0, "face", "yes", "Red, Def/MyColor"],
[5.0, 0, "ball", "no", "Green"]
]
}
],
"passes": [
{
"sidecar": {
"event_code": {
"HED": {
"face": "Acceleration/5 m-per-s^2",
"ball": "Def/Acc/7, Blue"
}
}
},
"events": [
["onset", "duration", "event_code", "response", "HED"],
[4.5, 0, "face", "yes", "Red, Def/MyColor"],
[5.0, 0, "ball", "no", "Green"]
]
}
]
}
}
},
{
"error_code": "SIDECAR_KEY_MISSING",
"alt_codes": [],
Expand Down Expand Up @@ -4155,7 +4013,7 @@
},
{
"error_code": "TAG_EXTENSION_INVALID",
"alt_codes": [],
"alt_codes": ["CHARACTER_INVALID", "PLACEHOLDER_INVALID"],
"name": "tag-extension-invalid-bad-node-name",
"description": "A tag extension term does not comply with rules for schema nodes.",
"warning": false,
Expand Down Expand Up @@ -7612,5 +7470,66 @@
]
}
}
},
{
"error_code": "VALUE_INVALID",
"alt_codes": ["UNITS_INVALID"],
"name": "invalid-character-numeric-class",
"description": "An invalid character was used in an 8.3.0 or greater style numeric value class.",
"warning": false,
"schema": "8.3.0",
"definitions": [],
"tests": {
"string_tests": {
"fails": [
"Weight/3.0$ kg",
"Weight/3.0db kg",
"Weight/3.0& kg",
"Weight/abc kg",
"Weight/*3.0 kg",
"Weight/3.0% kg",
"Weight/3.0^ kg",
"Weight/3.0? kg"
],
"passes": [
"Weight/3.0e10 kg",
"Weight/3e10 kg",
"Weight/3.0 kg",
"Weight/3000 kg",
"Weight/3e10 kg",
"Weight/3.5e10 kg",
"Weight/2.998e8 g",
"Weight/6.022e23 g",
"Weight/7.0e-10 g",
"Weight/1.6e-35 kg"
]
},
"sidecar_tests": {
"fails": [
{
"event_code": {
"HED": {
"show": "Weight/3.0a"
}
}
}
],
"passes": [
{
"event_code": {
"HED": "Weight/# g"
}
}
]
},
"event_tests": {
"fails": [],
"passes": []
},
"combo_tests": {
"fails": [],
"passes": []
}
}
}
]
Loading
Loading