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

v5.x-fromBase-type-param: Add type parameter to fromBase16 #819

Open
wants to merge 14 commits into
base: develop
Choose a base branch
from

Conversation

jozanek
Copy link
Collaborator

@jozanek jozanek commented Jul 14, 2022

No description provided.

@jozanek jozanek marked this pull request as draft July 14, 2022 13:27
@jozanek jozanek requested a review from aslesarenko July 14, 2022 13:27
val bytes = Base16.decode(arg.value).get
tpe match {
case SByteArray => ByteArrayConstant(bytes)
case other => ???
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see #814

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see updated version

// no type specified
an[InvalidArguments] should be thrownBy comp(""" fromBase16("0e0131") """)
// declared type != parsed type
an[InvalidArguments] should be thrownBy comp(""" fromBase16[Int]("0e0131") """)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. use assertExceptionThrown to test exceptions more precisely. See how it is used all over the code.
  2. Since the method should be generic and work for all types.
    This mean all types should be tested. See ConstantSerializerSpecification or DataSerializerSpecification for how it may look like. Those specifications are a bit less generic that they could be.
    Ideally you need:
  3. a generator of all valid types
  4. a generator of valid values for any valid type
  5. use forAll to test comp(...) for any (type, value) pair

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see updated version

@codecov
Copy link

codecov bot commented Jul 19, 2022

Codecov Report

Merging #819 (03152db) into develop (6392cbc) will decrease coverage by 0.01%.
The diff coverage is 65.62%.

@@             Coverage Diff             @@
##           develop     #819      +/-   ##
===========================================
- Coverage    71.51%   71.50%   -0.02%     
===========================================
  Files          246      246              
  Lines        18740    18769      +29     
  Branches       560      620      +60     
===========================================
+ Hits         13402    13420      +18     
- Misses        5338     5349      +11     
Impacted Files Coverage Δ
sigmastate/src/main/scala/sigmastate/types.scala 92.08% <54.16%> (-0.85%) ⬇️
...e/src/main/scala/sigmastate/lang/SigmaPredef.scala 98.74% <100.00%> (+0.01%) ⬆️
.../src/main/scala/special/collection/ViewColls.scala 87.91% <0.00%> (-1.10%) ⬇️
...cala/sigmastate/serialization/TypeSerializer.scala 95.68% <0.00%> (-0.87%) ⬇️
...ain/scala/special/collection/CollsOverArrays.scala 86.18% <0.00%> (-0.31%) ⬇️
...c/main/scala/special/sigma/impl/SigmaDslImpl.scala 46.38% <0.00%> (ø)
...n/scala/org/ergoplatform/ErgoLikeTransaction.scala 85.10% <0.00%> (ø)
...rc/main/scala/sigmastate/eval/RuntimeCosting.scala 91.16% <0.00%> (+0.10%) ⬆️
...te/src/main/scala/sigmastate/eval/Evaluation.scala 70.30% <0.00%> (+0.18%) ⬆️
.../sigmastate/serialization/ConstantSerializer.scala 100.00% <0.00%> (+14.28%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us.

@jozanek jozanek force-pushed the v5.x-fromBase-type-param branch from 66650d5 to 9ab6b62 Compare July 27, 2022 08:03
@jozanek jozanek marked this pull request as ready for review July 27, 2022 12:44
@aslesarenko aslesarenko added the A-frontend Area: ErgoScript compiler (source -> ErgoTree) label Jan 25, 2023
@jozanek
Copy link
Collaborator Author

jozanek commented Feb 17, 2023

@aslesarenko please review updated version of PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-frontend Area: ErgoScript compiler (source -> ErgoTree)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants