status-im / nim-protobuf-serialization

Apache License 2.0
19 stars 4 forks source link

Enum tests failing #51

Open BurnySc2 opened 1 year ago

BurnySc2 commented 1 year ago

Unsure if this is a duplicate of https://github.com/status-im/nim-protobuf-serialization/issues/39 , but the tests run via testament pattern "tests/*.nim" are failing. Specifically only the enum test.

As I'm new to nim, I'm not smart enough to submit a pull request to fix it.

Do you have a suggestion on a workaround? I can use ints instead of enums, but that doesn't seem like an ideal solution either. E.g.

x {.fieldNumber: 1, fixed.}: int32

instead of

x {.fieldNumber: 1.}: MyEnum
arnetheduck commented 1 year ago

I can use ints instead of enums, but that doesn't seem like an ideal solution either.

this would be the way to go since enum in in semantically differs significantly form its protobuf counterpart. In particular, you need to be careful around values that are not part of the enum that may appear in the stream - this is valid in protobuf but not in nim.