Open ehmry opened 1 year ago
Thanks for your contribution! The algorithm looks fine to me.
– Could you add tests for the toBytes
procedure?
– Could you add the corresponding fromBytes
procedure?
I believe that the tliterals was renamed literals as to not run these tests. You might want to check the log for this specific file.
I pushed a test for toBytes
. I will push fromBytes
soon.
Now with fromBytes
and a test of random serializations.
I'm against exporting isNegative
and isZero
. I think the better solution would be to support comparing with int
s, then we can just use < 0
and == 0
(see #132).
I'm against exporting
isNegative
andisZero
. I think the better solution would be to support comparing withint
s, then we can just use< 0
and== 0
(see #132).
That would be adding more code to do something that is already implemented.
I'm against exporting
isNegative
andisZero
. I think the better solution would be to support comparing withint
s, then we can just use< 0
and== 0
(see #132).That would be adding more code to do something that is already implemented.
Yes, but it's also uglier imo.
I am for exporting isNegative only and implement equality with integers. Comparing with integers and fetching a boolean flag are two different things.
Note that isNegative
really means "is less than or equal to zero", as 0 can also have isNegative
set.
Thanks for the reminder.
isNegative
andisZero
because it is easier to export here than to reimplement downstream.toBytes
proc for serializing. This is used by the CBOR package. Also easier to implement here than downstream.nimble test
for testing, some rely only on Nimble standards.