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

Commit 621901d

Browse files
authored
Merge pull request #401 from nicolasvasilache/pr/tc-with-newlines
Add test for TC with arbitrary newlines
2 parents 72e0703 + e03f917 commit 621901d

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

test/cuda/test_corner_cases.cc

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,44 @@ TEST(TestCornerCases, E23) {
282282
at::Scalar(d[0]).toFloat());
283283
}
284284

285+
// This tests that the TC parser functions in the presence of arbitrary newlines
286+
TEST(TestCornerCases, E24) {
287+
auto a = F(1);
288+
auto b = F(1);
289+
auto c = F(1);
290+
auto d = F(1);
291+
Succeed(
292+
R"TC(
293+
294+
def f(float(1)
295+
a, float(1
296+
) b, float
297+
(1) c) -> (d) { d(
298+
i)
299+
=
300+
301+
min(
302+
a(i), max(
303+
b(i), c(
304+
i)))
305+
306+
d(i) = d(i) + max(b(i),
307+
308+
c(
309+
i))
310+
311+
}
312+
)TC",
313+
{a, b, c},
314+
{d});
315+
CHECK_EQ(
316+
fminf(
317+
at::Scalar(a[0]).toFloat(),
318+
fmaxf(at::Scalar(b[0]).toFloat(), at::Scalar(c[0]).toFloat())) +
319+
fmaxf(at::Scalar(b[0]).toFloat(), at::Scalar(c[0]).toFloat()),
320+
at::Scalar(d[0]).toFloat());
321+
}
322+
285323
int main(int argc, char** argv) {
286324
::testing::InitGoogleTest(&argc, argv);
287325
::gflags::ParseCommandLineFlags(&argc, &argv, true);

0 commit comments

Comments
 (0)