Skip to content

Fix ScriptNum Tests#22786

Closed
fpelliccioni wants to merge 1 commit intobitcoin:masterfrom
fpelliccioni:fix_scriptnum_test
Closed

Fix ScriptNum Tests#22786
fpelliccioni wants to merge 1 commit intobitcoin:masterfrom
fpelliccioni:fix_scriptnum_test

Conversation

@fpelliccioni
Copy link
Copy Markdown

Summary

At first glance the test scriptnum_tests/operators has some issues:

  • It is not testing what it really want to test (I think).
  • If size(offsets) > size(values) the test program will crash.

I also took the opportunity to modernize the scriptnum_tests/creation code, but the semantics of the new code should be equivalent to that of the previous code.

Test Plan

  1. Build
  2. ./src/test/test_bitcoin -t scriptnum_tests/operators
  3. ./src/test/test_bitcoin -t scriptnum_tests/creation

@fpelliccioni fpelliccioni changed the title fix tests Fix ScriptNum Tests Aug 24, 2021
@DrahtBot DrahtBot added the Tests label Aug 24, 2021
RunOperators(a, -a);
RunOperators(a, b);
RunOperators(a, -b);
RunOperators(a + b, b);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I suspect these should have been of the form value + offset rather than value + value

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hmm. Good question. The original PR is #3965

@theuni (original PR author) -- What was the intention here?

Copy link
Copy Markdown
Contributor

@rajarshimaitra rajarshimaitra left a comment

Choose a reason for hiding this comment

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

Concept ACK on code change. Seems cleaner.

But I am confused. This doesn't seem to address the issues mentioned in the PR description. Only the modernization.

Can you explain what did you mean by "it's not checking what it intends to check"?

@laanwj
Copy link
Copy Markdown
Member

laanwj commented Nov 10, 2021

I'm also a bit confused here. What is the intent of the original code, what changed here. Next time, please separate out "modernization" from fixes into separate commits at least (it's fine to have them in the same PR).

@laanwj
Copy link
Copy Markdown
Member

laanwj commented Dec 17, 2021

Closing this for now. Please let me know if you intend to continue work on this and address the comments.

@laanwj laanwj closed this Dec 17, 2021
@bitcoin bitcoin locked and limited conversation to collaborators Dec 17, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants