Skip to content

Commit 90fd79c

Browse files
committed
Added multiple argument test to test/unit/math/prim/functor/apply_test.cpp
1 parent b5c7f26 commit 90fd79c

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

test/unit/math/prim/functor/apply_test.cpp

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,3 +85,21 @@ TEST(MathFunctions, apply_temporary_function_return_const_reference) {
8585
EXPECT_EQ(1.0, y);
8686
EXPECT_TRUE((std::is_same<const double&, decltype(y)>::value));
8787
}
88+
89+
TEST(MathFunctions, apply_two_args) {
90+
std::tuple<double, int> x = std::make_tuple(1.5, 1);
91+
92+
auto y = stan::math::apply([](double x0, int x1) { return x0 + x1; }, x);
93+
94+
EXPECT_EQ(2.5, y);
95+
EXPECT_TRUE((std::is_same<double, decltype(y)>::value));
96+
}
97+
98+
TEST(MathFunctions, apply_three_args) {
99+
std::tuple<double, double, int> x = std::make_tuple(1.5, 0.75, 1);
100+
101+
auto y = stan::math::apply([](double x0, double x1, int x2) { return x0 + x1 + x2; }, x);
102+
103+
EXPECT_EQ(3.25, y);
104+
EXPECT_TRUE((std::is_same<double, decltype(y)>::value));
105+
}

0 commit comments

Comments
 (0)