Skip to content

Conversation

kallewoof
Copy link
Contributor

@kallewoof kallewoof commented Apr 9, 2018

A number of BOOST_CHECK_EQUAL calls would result in warnings about signs.

This PR fixes signedness for all expectation values, sometimes resulting in intunsigned int. No other code changes besides adding/removing U to/from values.

Running make &> make_output_... on master versus on this PR:

$ wc make_output_*
    1464    5925   90357 make_output_master
     613    1469   28370 make_output_signfixed

More than halves the output lines from compiling.

@fanquake fanquake added the Tests label Apr 9, 2018
@practicalswift
Copy link
Contributor

utACK 08f99ecf30ff994e57045ed633c0ab4e61f01ea6

@maflcko
Copy link
Member

maflcko commented Apr 9, 2018

What tool have you used to see the warnings?

@kallewoof
Copy link
Contributor Author

kallewoof commented Apr 9, 2018

@MarcoFalke macOS clang (g++)

To clarify, these warnings show up when compiling bitcoin. It's not some obscure linter somewhere.

@kallewoof
Copy link
Contributor Author

Running make &> make_output_... on master versus on this PR:

$ wc make_output_*
    1464    5925   90357 make_output_master
     613    1469   28370 make_output_signfixed

More than halves the output lines from compiling.

BOOST_CHECK_EQUAL(cc1.nHeight, 203998);
BOOST_CHECK_EQUAL(cc1.out.nValue, 60000000000ULL);
BOOST_CHECK_EQUAL(cc1.nHeight, 203998U);
BOOST_CHECK_EQUAL(cc1.out.nValue, 60000000000LL);
Copy link
Member

Choose a reason for hiding this comment

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

nit: I think CAmount{60000000000} works as well

@@ -55,7 +55,7 @@ BOOST_AUTO_TEST_CASE(subsidy_limit_test)
nSum += nSubsidy * 1000;
BOOST_CHECK(MoneyRange(nSum));
}
BOOST_CHECK_EQUAL(nSum, 2099999997690000ULL);
BOOST_CHECK_EQUAL(nSum, 2099999997690000LL);
Copy link
Member

Choose a reason for hiding this comment

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

nit: Same here CAmount{2099999997690000}

@maflcko
Copy link
Member

maflcko commented Apr 10, 2018

utACK 08f99ecf30ff994e57045ed633c0ab4e61f01ea6

A number of BOOST_CHECK_EQUAL calls would result in warnings about signs.
@kallewoof
Copy link
Contributor Author

Switched to CAmount{} according to @MarcoFalke nits.

@jonasschnelli
Copy link
Contributor

Tested ACK c55aa4f
(fixed my new boost::test warnings on macOS 10.12)

@maflcko
Copy link
Member

maflcko commented Apr 11, 2018

re-utACK c55aa4f

@laanwj laanwj merged commit c55aa4f into bitcoin:master Apr 11, 2018
laanwj added a commit that referenced this pull request Apr 11, 2018
c55aa4f test: Fix sign for expected values (Karl-Johan Alm)

Pull request description:

  A number of `BOOST_CHECK_EQUAL` calls would result in warnings about signs.

  This PR fixes signedness for all expectation values, sometimes resulting in `int` → `unsigned int`. No other code changes besides adding/removing `U` to/from values.

  Running `make &> make_output_...` on master versus on this PR:
  ```
  $ wc make_output_*
      1464    5925   90357 make_output_master
       613    1469   28370 make_output_signfixed
  ```
  More than halves the output lines from compiling.

Tree-SHA512: b06c9fb81704fd32a6a61fe7b2ceb5f1bb381e9873d79e13d7e4d26bbd9b67c9725a84e6fb2903bcda775aea2a792e544b0799d36735c19f5d1c7225e8c6d14e
jasonbcox pushed a commit to Bitcoin-ABC/bitcoin-abc that referenced this pull request Sep 27, 2019
Summary:
c55aa4f test: Fix sign for expected values (Karl-Johan Alm)

Pull request description:

  A number of `BOOST_CHECK_EQUAL` calls would result in warnings about signs.

  This PR fixes signedness for all expectation values, sometimes resulting in `int` → `unsigned int`. No other code changes besides adding/removing `U` to/from values.

  Running `make &> make_output_...` on master versus on this PR:
  ```
  $ wc make_output_*
      1464    5925   90357 make_output_master
       613    1469   28370 make_output_signfixed
  ```
  More than halves the output lines from compiling.

Tree-SHA512: b06c9fb81704fd32a6a61fe7b2ceb5f1bb381e9873d79e13d7e4d26bbd9b67c9725a84e6fb2903bcda775aea2a792e544b0799d36735c19f5d1c7225e8c6d14e

Partial Backport of Core PR12920
bitcoin/bitcoin#12920

Same as D3882, but excludes code dependent on PR11293

Test Plan:
  make check

Reviewers: O1 Bitcoin ABC, #bitcoin_abc, deadalnix, Fabien, jasonbcox

Reviewed By: O1 Bitcoin ABC, #bitcoin_abc, deadalnix

Differential Revision: https://reviews.bitcoinabc.org/D4104
@kallewoof kallewoof deleted the test-signs branch October 17, 2019 08:36
jasonbcox pushed a commit to Bitcoin-ABC/bitcoin-abc that referenced this pull request Dec 6, 2019
…verage

Summary:
46ce223 Add tests for CMerkleBlock usage with txids specified (James O'Beirne)

Pull request description:

  What started as a simple task to add test coverage ended up giving way to a light refactoring. This consolidates the mostly-identical `CMerkleBlock` constructors into one (using C++11 constructor delegation) and adds coverage for the by-txids construction case.

  ### Before

  ![selection_006](https://user-images.githubusercontent.com/73197/30242104-0f381fe4-9545-11e7-9617-83b87fce0456.png)

  ### After

  ![selection_008](https://user-images.githubusercontent.com/73197/30242107-1425dfaa-9545-11e7-9e6b-2c3432517dd1.png)

Tree-SHA512: eed84ed3e8bfc43473077b575c8252759a857e37275e4b36ca7cc2c17a65895e5f494bfd9d4aeab09fc6e98fc6a9c641ac7ecc0ddbeefe01a9e4308e7909e529

Changes made in D3371 conflict with the original PR; the constructor has been updated to the form it would take if D3371 would have been implemented after this refactoring. This private constructor is more strict than the original one (the original could be called with either, both, or neither of the `filter` and `txids` parameters).

Partial backport of Core PR11293
bitcoin/bitcoin#11293

Also includes left over changes to PR12920
bitcoin/bitcoin#12920

Test Plan:
  make check
  ninja check

Reviewers: deadalnix, Fabien, jasonbcox, O1 Bitcoin ABC, #bitcoin_abc, nakihito

Reviewed By: deadalnix, Fabien, jasonbcox, O1 Bitcoin ABC, #bitcoin_abc, nakihito

Differential Revision: https://reviews.bitcoinabc.org/D3689
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Apr 13, 2021
c55aa4f test: Fix sign for expected values (Karl-Johan Alm)

Pull request description:

  A number of `BOOST_CHECK_EQUAL` calls would result in warnings about signs.

  This PR fixes signedness for all expectation values, sometimes resulting in `int` → `unsigned int`. No other code changes besides adding/removing `U` to/from values.

  Running `make &> make_output_...` on master versus on this PR:
  ```
  $ wc make_output_*
      1464    5925   90357 make_output_master
       613    1469   28370 make_output_signfixed
  ```
  More than halves the output lines from compiling.

Tree-SHA512: b06c9fb81704fd32a6a61fe7b2ceb5f1bb381e9873d79e13d7e4d26bbd9b67c9725a84e6fb2903bcda775aea2a792e544b0799d36735c19f5d1c7225e8c6d14e
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Apr 17, 2021
c55aa4f test: Fix sign for expected values (Karl-Johan Alm)

Pull request description:

  A number of `BOOST_CHECK_EQUAL` calls would result in warnings about signs.

  This PR fixes signedness for all expectation values, sometimes resulting in `int` → `unsigned int`. No other code changes besides adding/removing `U` to/from values.

  Running `make &> make_output_...` on master versus on this PR:
  ```
  $ wc make_output_*
      1464    5925   90357 make_output_master
       613    1469   28370 make_output_signfixed
  ```
  More than halves the output lines from compiling.

Tree-SHA512: b06c9fb81704fd32a6a61fe7b2ceb5f1bb381e9873d79e13d7e4d26bbd9b67c9725a84e6fb2903bcda775aea2a792e544b0799d36735c19f5d1c7225e8c6d14e
kwvg pushed a commit to kwvg/dash that referenced this pull request Apr 23, 2021
c55aa4f test: Fix sign for expected values (Karl-Johan Alm)

Pull request description:

  A number of `BOOST_CHECK_EQUAL` calls would result in warnings about signs.

  This PR fixes signedness for all expectation values, sometimes resulting in `int` → `unsigned int`. No other code changes besides adding/removing `U` to/from values.

  Running `make &> make_output_...` on master versus on this PR:
  ```
  $ wc make_output_*
      1464    5925   90357 make_output_master
       613    1469   28370 make_output_signfixed
  ```
  More than halves the output lines from compiling.

Tree-SHA512: b06c9fb81704fd32a6a61fe7b2ceb5f1bb381e9873d79e13d7e4d26bbd9b67c9725a84e6fb2903bcda775aea2a792e544b0799d36735c19f5d1c7225e8c6d14e
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Dec 16, 2021
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