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

to lowercase before hash #321

Merged
merged 5 commits into from
Dec 22, 2023
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
10 changes: 5 additions & 5 deletions tests/vspec/test_static_uids/test_static_uids.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,11 @@ def change_test_dir(request, monkeypatch):
@pytest.mark.parametrize(
"node_name, unit, datatype, allowed, minimum, maximum, result_static_uid",
[
("TestNode", "m", VSSDataType.UINT16, "", 0, 10000, "156365B2"),
("TestNode", "mm", VSSDataType.UINT32, "", "", "", "0931A8FA"),
("TestUnit", "degrees/s", VSSDataType.FLOAT, "", "", "", "C733138C"),
("TestMinMax", "percent", VSSDataType.UINT8, "", 0, 100, "72A24EF1"),
("TestEnum", "m", VSSDataType.STRING, ["YES, NO"], "", "", "DEA50110"),
("TestNode", "m", VSSDataType.UINT16, "", 0, 10000, "A1D565B2"),
("TestNode", "mm", VSSDataType.UINT32, "", "", "", "B5D7A8FA"),
("TestUnit", "degrees/s", VSSDataType.FLOAT, "", "", "", "DEA9138C"),
("TestMinMax", "percent", VSSDataType.UINT8, "", 0, 100, "88FC5491"),
("TestEnum", "m", VSSDataType.STRING, ["YES, NO"], "", "", "06AEB370"),
],
)
def test_generate_id(
Expand Down
22 changes: 11 additions & 11 deletions tests/vspec/test_static_uids/validation.yaml
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
A:
description: A is a test node
staticUID: '0x6865518C'
staticUID: '0x5B38F4AC'
type: branch
A.B:
description: B is a branch of A
staticUID: '0x5EE0702C'
staticUID: '0x4687862C'
type: branch
A.B.Int32:
datatype: int32
description: A.B.Int32 is a leaf of A.B of datatype int32
staticUID: '0x4322A0BF'
staticUID: '0xF59053DF'
type: sensor
unit: rpm
A.B.IsLeaf:
Expand All @@ -18,20 +18,20 @@ A.B.IsLeaf:
- 'NO'
datatype: string
description: This node is a leaf of the tree and it has allowed values (aka an enum).
staticUID: '0x51887178'
staticUID: '0x41EF3218'
type: actuator
A.B.Max:
datatype: uint8
description: A leaf that uses a maximum value.
max: 100
staticUID: '0xACFF72AC'
staticUID: '0xCF708DCC'
type: sensor
unit: percent
A.B.Min:
datatype: uint8
description: A leaf that uses a minimum value.
min: 10
staticUID: '0xF66F948E'
staticUID: '0x2FC6BA2E'
type: sensor
unit: percent
A.B.NewName:
Expand All @@ -40,29 +40,29 @@ A.B.NewName:
fka:
- A.B.OldName
- A.B.OlderName
staticUID: '0x63C22EF6'
staticUID: '0x126503B6'
type: sensor
unit: mm
A.Float:
datatype: float
description: A.Float is a leaf of A of datatype float
staticUID: '0xC83DDDBF'
staticUID: '0xA493DFBF'
type: actuator
unit: mm
A.Int16:
datatype: int16
description: A.Int16 is a leaf of A of datatype int16
staticUID: '0xC50253A3'
staticUID: '0x3D9D89A3'
type: sensor
unit: rpm
A.String:
datatype: string
deprecation: This is test deprecation, let's say it used to be called Str instead String.
description: A.String is a leaf of A of datatype string
staticUID: '0x215470FC'
staticUID: '0x49A622FC'
type: sensor
A.StringArray:
datatype: string[]
description: A.StringArray is a leaf of A of datatype string array
staticUID: '0x2115794B'
staticUID: '0xE8A4A62B'
type: sensor
25 changes: 13 additions & 12 deletions tests/vspec/test_static_uids/validation_vspecs/validation.vspec
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@

A:
description: A is a test node
staticUID: '0x6865518C'
staticUID: '0x5B38F4AC'
type: branch
A.B:
description: B is a branch of A
staticUID: '0x5EE0702C'
staticUID: '0x4687862C'
type: branch
A.B.Int32:
datatype: int32
description: A.B.Int32 is a leaf of A.B of datatype int32
staticUID: '0x4322A0BF'
staticUID: '0xF59053DF'
type: sensor
unit: rpm
A.B.IsLeaf:
Expand All @@ -26,20 +26,20 @@ A.B.IsLeaf:
- 'NO'
datatype: string
description: This node is a leaf of the tree and it has allowed values (aka an enum).
staticUID: '0x51887178'
staticUID: '0x41EF3218'
type: actuator
A.B.Max:
datatype: uint8
description: A leaf that uses a maximum value.
max: 100
staticUID: '0xACFF72AC'
staticUID: '0xCF708DCC'
type: sensor
unit: percent
A.B.Min:
datatype: uint8
description: A leaf that uses a minimum value.
min: 10
staticUID: '0xF66F948E'
staticUID: '0x2FC6BA2E'
type: sensor
unit: percent
A.B.NewName:
Expand All @@ -48,29 +48,30 @@ A.B.NewName:
fka:
- A.B.OldName
- A.B.OlderName
staticUID: '0x63C22EF6'
staticUID: '0x126503B6'
type: sensor
unit: mm
A.Float:
datatype: float
description: A.Float is a leaf of A of datatype float
staticUID: '0xC83DDDBF'
staticUID: '0xA493DFBF'
type: actuator
unit: mm
A.Int16:
datatype: int16
description: A.Int16 is a leaf of A of datatype int16
staticUID: '0xC50253A3'
staticUID: '0x3D9D89A3'
type: sensor
unit: rpm
A.String:
datatype: string
deprecation: This is test deprecation, let's say it used to be called Str instead String.
deprecation: This is test deprecation, let's say it used to be called Str instead
String.
description: A.String is a leaf of A of datatype string
staticUID: '0x215470FC'
staticUID: '0x49A622FC'
type: sensor
A.StringArray:
datatype: string[]
description: A.StringArray is a leaf of A of datatype string array
staticUID: '0x2115794B'
staticUID: '0xE8A4A62B'
type: sensor
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@

A:
description: A is a test node
staticUID: '0x6865518C'
staticUID: '0x5B38F4AC'
type: branch
A.B:
description: B is a branch of A
staticUID: '0x5EE0702C'
staticUID: '0x4687862C'
type: branch
A.B.Int32:
datatype: int32
description: A.B.Int32 is a leaf of A.B of datatype int32
staticUID: '0x4322A0BF'
staticUID: '0xF59053DF'
type: sensor
unit: rpm
A.B.IsLeaf:
Expand All @@ -26,49 +26,51 @@ A.B.IsLeaf:
- 'NO'
datatype: string
description: This node is a leaf of the tree and it has allowed values (aka an enum).
staticUID: '0x51887178'
staticUID: '0x41EF3218'
type: actuator
A.B.Max:
datatype: uint8
description: A leaf that uses a maximum value.
max: 100
staticUID: '0xACFF72AC'
staticUID: '0xCF708DCC'
type: sensor
unit: percent
A.B.Min:
datatype: uint8
description: A leaf that uses a minimum value.
min: 10
staticUID: '0xF66F948E'
staticUID: '0x2FC6BA2E'
type: sensor
unit: percent
A.B.OldName:
datatype: uint32
description: A.B.NewName's old name is 'OldName'. And its even older name is 'OlderName'.
fka:
- A.B.OlderName
staticUID: '0xD4DFF5FD'
staticUID: '0x8B7DE17D'
type: sensor
unit: mm
A.Float:
datatype: float
description: A.Float is a leaf of A of datatype float
staticUID: '0xC83DDDBF'
staticUID: '0xA493DFBF'
type: actuator
unit: mm
A.Int16:
datatype: int16
description: A.Int16 is a leaf of A of datatype int16
staticUID: '0xC50253A3'
staticUID: '0x3D9D89A3'
type: sensor
unit: rpm
A.String:
datatype: string
deprecation: This is test deprecation, let's say it used to be called Str instead
String.
description: A.String is a leaf of A of datatype string
staticUID: '0x215470FC'
staticUID: '0x49A622FC'
type: sensor
A.StringArray:
datatype: string[]
description: A.StringArray is a leaf of A of datatype string array
staticUID: '0x2115794B'
staticUID: '0xE8A4A62B'
type: sensor
2 changes: 1 addition & 1 deletion vspec/utils/idgen_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def get_node_identifier_bytes(
f"allowed: {allowed}"
f"min: {minimum}"
f"max: {maximum}"
).encode("utf-8")
).encode("utf-8").lower()


def fnv1_32_hash(identifier: bytes) -> int:
Expand Down