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

Add missing testcase about NaN in unit-constructor1.cpp #2043

Merged
merged 1 commit into from
Apr 21, 2020

Conversation

dota17
Copy link
Contributor

@dota17 dota17 commented Apr 16, 2020

[Describe your pull request here. Please read the text below the line, and make sure you follow the checklist.]


Pull request checklist

Read the Contribution Guidelines for detailed information.

  • Changes are described in the pull request, or an existing issue is referenced.
  • The test suite compiles and runs without error.
  • Code coverage is 100%. Test cases can be added by editing the test suite.
  • The source code is amalgamated; that is, after making changes to the sources in the include/nlohmann directory, run make amalgamate to create the single-header file single_include/nlohmann/json.hpp. The whole process is described here.

@dota17 dota17 requested a review from nlohmann as a code owner April 16, 2020 02:26

// check round trip of NaN
json::number_float_t d = j;
CHECK(d == n);
Copy link
Owner

Choose a reason for hiding this comment

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

Apparently, comparing NaNs with == does not work, hence all CI builds fail. Please check https://stackoverflow.com/questions/15268864/how-to-compare-two-nan-values-in-c.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Okay, I'll close this. Thanks for reminding : )

Copy link
Owner

Choose a reason for hiding this comment

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

I did not mean to close this - maybe

CHECK(std::is_nan(d) and std::is_nan(n));

would also do the job?

@dota17 dota17 closed this Apr 17, 2020
@dota17 dota17 deleted the unit-constructor1 branch April 17, 2020 02:09
@dota17 dota17 restored the unit-constructor1 branch April 20, 2020 01:35
@dota17 dota17 reopened this Apr 20, 2020
@dota17 dota17 force-pushed the unit-constructor1 branch from a8beddb to bb1843b Compare April 20, 2020 02:23
@dota17 dota17 force-pushed the unit-constructor1 branch from bb1843b to c379d02 Compare April 20, 2020 02:26
Copy link
Owner

@nlohmann nlohmann left a comment

Choose a reason for hiding this comment

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

Looks good to me.

@nlohmann nlohmann self-assigned this Apr 21, 2020
@nlohmann nlohmann added this to the Release 3.8.0 milestone Apr 21, 2020
@nlohmann nlohmann merged commit 63afc8e into nlohmann:develop Apr 21, 2020
@nlohmann
Copy link
Owner

Thanks!

@nlohmann
Copy link
Owner


🔖 Release item

This issue/PR will be part of the next release of the library. This template helps preparing the release notes.

Type

  • ✨ New Feature
  • 🐛 Bug Fix
  • ⚡️ Improvement
  • 🔨 Further Change
  • 🔥 Deprecated function

Description


@dota17 dota17 deleted the unit-constructor1 branch May 6, 2020 01:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants