-
Notifications
You must be signed in to change notification settings - Fork 81
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
VM: fix some bugs from JSON tests #394
Conversation
Looks like we have the same problem as in ca10fb0 with |
And BTW, we need to fix them one way or another before this merge. |
Codecov Report
@@ Coverage Diff @@
## master #394 +/- ##
==========================================
+ Coverage 49.91% 50.34% +0.43%
==========================================
Files 81 80 -1
Lines 5469 5430 -39
==========================================
+ Hits 2730 2734 +4
+ Misses 2484 2446 -38
+ Partials 255 250 -5
Continue to review full report at Codecov.
|
I have added |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2ef8145 does more than it's written in the commit message, you should also mention changes made wrt type handling changes.
Please, also fix REVERSE behavior to not push the result to the stack, it's the only one left with this bug after the current patchset. |
Also make tests expect []byte{} instead of 0.
Also add more tests. Extend `Array` method of `Element` to work with `StructItem`.
NIP
,(X)DROP
,ROT
orEQUAL
have not enough arguments.XTUCK
argument is 0PICKITEM
should accept bytearraysNEWARRAY
/NEWSTRUCT
should create array ofBoolItem{false}
items instead ofnil
sREMOVE
should return value of the same type as the argument (do not performStruct -> Array
conversion)PUSH0
should push empty byte array (it is converted when 0 is needed)NEWARRAY
can accept[]byte
operand. Common usecase:PUSH0, NEWARRAY
SIZE
can accept any argument castable toByteArray
SHL
/SHR
do not change type of the operand if shift is by 0 (if applied to bytearray, leave bytearray as it is).There are to more bugs specified in #196 . They include using
Array
as a pointer value and can me more prone to hidden bugs, so I will do this separately.There are some tests in
pkg/vm/tests/
which fail. I am not sure if tests or codegen should be fixed. E.g. if user is expectingInteger
we could emitPUSH0, ADD
on top of[]byte
item to returnInteger
. Or just make tests expect[]byte{0}
. All this implicit conversions stuff is rather annoying both from user's and developer's point of view.