-
Notifications
You must be signed in to change notification settings - Fork 1.4k
[hist] Check arguments in axis constructors #19483
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
base: master
Are you sure you want to change the base?
Conversation
Test Results 21 files 21 suites 3d 9h 15m 16s ⏱️ For more details on these failures, see this check. Results for commit f3796f3. ♻️ This comment has been updated with latest results. |
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.
Looks much better!
/// \param[in] enableFlowBins whether to enable underflow and overflow bins | ||
RVariableBinAxis(std::vector<double> binEdges, bool enableFlowBins = true) | ||
: fBinEdges(std::move(binEdges)), fEnableFlowBins(enableFlowBins) | ||
{ | ||
// FIXME: should validate that fBinEdges is sorted | ||
if (fBinEdges.size() < 2) { | ||
throw std::invalid_argument("must have >= 2 edges"); |
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.
throw std::invalid_argument("must have >= 2 edges"); | |
throw std::invalid_argument("must have >= 2 edges, but has " + std::to_string(fBinEdges.size())); |
/// \param[in] enableFlowBins whether to enable underflow and overflow bins | ||
RRegularAxis(std::size_t numNormalBins, double low, double high, bool enableFlowBins = true) | ||
: fNumNormalBins(numNormalBins), fLow(low), fHigh(high), fEnableFlowBins(enableFlowBins) | ||
{ | ||
// FIXME: should validate numNormalBins > 0 and low < high | ||
if (numNormalBins == 0) { | ||
throw std::invalid_argument("numNormalBins must be > 0"); |
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.
throw std::invalid_argument("numNormalBins must be > 0"); | |
throw std::invalid_argument("numNormalBins=" + std::to_string(numNormalBins) + " must be > 0"); |
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.
I don't think we need this: numNormalBins
is unsigned, so the only value that triggers this exception is 0.
Also test
ComputeLinearizedIndex
exactly on the edges (this already worked since #19334).