status-im / nim-protobuf-serialization

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Enum tests failing

BurnySc2 opened this issue · comments

Unsure if this is a duplicate of #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

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.