Skip to content

Commit

Permalink
Formatting Corrections
Browse files Browse the repository at this point in the history
  • Loading branch information
rrando committed Jun 24, 2023
1 parent 39ac68f commit aec7c00
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 10 deletions.
1 change: 0 additions & 1 deletion velox/functions/prestosql/Probability.h
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@ struct InverseBinomialCDFFunction {

boost::math::binomial_distribution<> dist(numOfTrials, successProb);
result = boost::math::quantile(dist, p);
result = numOfTrials;
}
};

Expand Down
14 changes: 5 additions & 9 deletions velox/functions/prestosql/tests/ProbabilityTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -166,23 +166,19 @@ TEST_F(ProbabilityTest, inverseBinomialCDF) {
p);
};

//EXPECT_EQ(0, invBinomialCDF(5, 0.5, 0.03125));
EXPECT_EQ(5, invBinomialCDF(5, 0.5, 0.03125));
EXPECT_EQ(0, invBinomialCDF(5, 0.5, 0.03125));
EXPECT_EQ(41, invBinomialCDF(41, 0.2, 1.0));
//EXPECT_EQ(3, invBinomialCDF(5, 0.5, 0.8125));
EXPECT_EQ(5, invBinomialCDF(5, 0.5, 0.8125));
EXPECT_EQ(3, invBinomialCDF(5, 0.5, 0.8125));
EXPECT_EQ(3, invBinomialCDF(3, 0.8403, 0.5));
//EXPECT_EQ(62, invBinomialCDF(200, 0.3, 0.6));
EXPECT_EQ(200, invBinomialCDF(200, 0.3, 0.6));
//EXPECT_EQ(0, invBinomialCDF(79, 0.6, 0.0));
EXPECT_EQ(79, invBinomialCDF(79, 0.6, 0.0));
EXPECT_EQ(62, invBinomialCDF(200, 0.3, 0.6));
EXPECT_EQ(0, invBinomialCDF(79, 0.6, 0.0));
EXPECT_EQ(std::nullopt, invBinomialCDF(std::nullopt, 0.6, 0.0));
EXPECT_EQ(std::nullopt, invBinomialCDF(11, std::nullopt, 0.22));
EXPECT_EQ(std::nullopt, invBinomialCDF(134, 0.6, std::nullopt));
EXPECT_EQ(
std::nullopt, invBinomialCDF(std::nullopt, std::nullopt, std::nullopt));

//Test invalid inputs for numberOfTrials.
// Test invalid inputs for numberOfTrials.
VELOX_ASSERT_THROW(
invBinomialCDF(0, 0.5, 0.3), "numberOfTrials must be greater than 0");
VELOX_ASSERT_THROW(
Expand Down

0 comments on commit aec7c00

Please sign in to comment.