Skip to content
This repository was archived by the owner on Apr 28, 2023. It is now read-only.

Commit 159908a

Browse files
committed
add min(max) test
1 parent ef2d882 commit 159908a

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

test/cuda/test_corner_cases.cc

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,22 @@ TEST(TestCornerCases, E22) {
269269
at::Scalar(c[0]).toFloat());
270270
}
271271

272+
TEST(TestCornerCases, E23) {
273+
auto a = F(1);
274+
auto b = F(1);
275+
auto c = F(1);
276+
auto d = F(1);
277+
Succeed(
278+
"def f(float(1) a, float(1) b, float(1) c) -> (d) { d(i) = min(a(i), max(b(i), c(i))) }",
279+
{a, b, c},
280+
{d});
281+
CHECK_EQ(
282+
fminf(
283+
at::Scalar(a[0]).toFloat(),
284+
fmaxf(at::Scalar(b[0]).toFloat(), at::Scalar(c[0]).toFloat())),
285+
at::Scalar(d[0]).toFloat());
286+
}
287+
272288
int main(int argc, char** argv) {
273289
::testing::InitGoogleTest(&argc, argv);
274290
::gflags::ParseCommandLineFlags(&argc, &argv, true);

0 commit comments

Comments
 (0)