-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Aligning messages to what is stated in documentation after COVESA/vehicle_signal_specification#716 Signed-off-by: Erik Jaegervall <[email protected]>
- Loading branch information
Showing
12 changed files
with
215 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Copyright (c) 2024 Contributors to COVESA | ||
# | ||
# This program and the accompanying materials are made available under the | ||
# terms of the Mozilla Public License 2.0 which is available at | ||
# https://www.mozilla.org/en-US/MPL/2.0/ | ||
# | ||
# SPDX-License-Identifier: MPL-2.0 | ||
|
||
A: | ||
type: branch | ||
description: This description is mandatory! | ||
|
||
A.UInt8: | ||
datatype: uint8 | ||
type: sensor | ||
unit: km | ||
description: Name OK! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Copyright (c) 2024 Contributors to COVESA | ||
# | ||
# This program and the accompanying materials are made available under the | ||
# terms of the Mozilla Public License 2.0 which is available at | ||
# https://www.mozilla.org/en-US/MPL/2.0/ | ||
# | ||
# SPDX-License-Identifier: MPL-2.0 | ||
|
||
A: | ||
type: branch | ||
description: This description is mandatory! | ||
|
||
A.IsSomething: | ||
datatype: boolean | ||
type: sensor | ||
unit: km | ||
description: OK name for a boolean! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Copyright (c) 2024 Contributors to COVESA | ||
# | ||
# This program and the accompanying materials are made available under the | ||
# terms of the Mozilla Public License 2.0 which is available at | ||
# https://www.mozilla.org/en-US/MPL/2.0/ | ||
# | ||
# SPDX-License-Identifier: MPL-2.0 | ||
|
||
A: | ||
type: branch | ||
description: This description is mandatory! | ||
|
||
A.uInt8: | ||
datatype: uint8 | ||
type: sensor | ||
unit: km | ||
description: First letter must be capital! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Copyright (c) 2024 Contributors to COVESA | ||
# | ||
# This program and the accompanying materials are made available under the | ||
# terms of the Mozilla Public License 2.0 which is available at | ||
# https://www.mozilla.org/en-US/MPL/2.0/ | ||
# | ||
# SPDX-License-Identifier: MPL-2.0 | ||
|
||
A: | ||
type: branch | ||
description: This description is mandatory! | ||
|
||
A.NotStartingWithIs: | ||
datatype: boolean | ||
type: sensor | ||
unit: km | ||
description: Faulty name for boolean (if for VSS catalog)! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
#!/usr/bin/env python3 | ||
|
||
# Copyright (c) 2024 Contributors to COVESA | ||
# | ||
# This program and the accompanying materials are made available under the | ||
# terms of the Mozilla Public License 2.0 which is available at | ||
# https://www.mozilla.org/en-US/MPL/2.0/ | ||
# | ||
# SPDX-License-Identifier: MPL-2.0 | ||
|
||
import pytest | ||
import os | ||
|
||
|
||
@pytest.fixture | ||
def change_test_dir(request, monkeypatch): | ||
# To make sure we run from test directory | ||
monkeypatch.chdir(request.fspath.dirname) | ||
|
||
|
||
@pytest.mark.parametrize("vspec_file", [ | ||
"correct.vspec", | ||
"correct_boolean.vspec", | ||
"faulty_case.vspec", | ||
"faulty_name_boolean.vspec" | ||
]) | ||
def test_not_strict(vspec_file: str, change_test_dir): | ||
test_str = "../../../vspec2json.py --json-pretty -u ../test_units.yaml " + vspec_file + \ | ||
" out.json > out.txt 2>&1" | ||
result = os.system(test_str) | ||
assert os.WIFEXITED(result) | ||
assert os.WEXITSTATUS(result) == 0 | ||
|
||
test_str = 'grep \"You asked for strict checking. Terminating\" out.txt > /dev/null' | ||
result = os.system(test_str) | ||
os.system("cat out.txt") | ||
os.system("rm -f out.json out.txt") | ||
assert os.WIFEXITED(result) | ||
assert os.WEXITSTATUS(result) != 0 | ||
|
||
|
||
@pytest.mark.parametrize("vspec_file", [ | ||
"correct.vspec", | ||
"correct_boolean.vspec" | ||
]) | ||
def test_strict_ok(vspec_file: str, change_test_dir): | ||
test_str = "../../../vspec2json.py --json-pretty -s -u ../test_units.yaml " + vspec_file + \ | ||
" out.json > out.txt 2>&1" | ||
result = os.system(test_str) | ||
assert os.WIFEXITED(result) | ||
assert os.WEXITSTATUS(result) == 0 | ||
|
||
test_str = 'grep \"You asked for strict checking. Terminating\" out.txt > /dev/null' | ||
result = os.system(test_str) | ||
os.system("cat out.txt") | ||
os.system("rm -f out.json out.txt") | ||
assert os.WIFEXITED(result) | ||
assert os.WEXITSTATUS(result) != 0 | ||
|
||
|
||
@pytest.mark.parametrize("vspec_file", [ | ||
"faulty_case.vspec", | ||
"faulty_name_boolean.vspec" | ||
]) | ||
def test_strict_error(vspec_file: str, change_test_dir): | ||
test_str = "../../../vspec2json.py --json-pretty -s -u ../test_units.yaml " + vspec_file + \ | ||
" out.json > out.txt 2>&1" | ||
result = os.system(test_str) | ||
assert os.WIFEXITED(result) | ||
assert os.WEXITSTATUS(result) != 0 | ||
|
||
test_str = 'grep \"You asked for strict checking. Terminating.\" out.txt > /dev/null' | ||
result = os.system(test_str) | ||
os.system("cat out.txt") | ||
os.system("rm -f out.json out.txt") | ||
assert os.WIFEXITED(result) | ||
assert os.WEXITSTATUS(result) == 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters