[flang-commits] [PATCH] D105837: [flang] Add scalar argument case for the Fortran Spread intrinsic unit test
Mark LeAir via Phabricator via flang-commits
flang-commits at lists.llvm.org
Mon Jul 12 12:48:51 PDT 2021
mleair created this revision.
mleair added reviewers: klausler, PeteSteinfeld.
mleair added a project: Flang.
Herald added a subscriber: jdoerfert.
mleair requested review of this revision.
The Fortran Spread intrinsic can take an array or a scalar source argument. The unit test had two tests but they both operated on arrays. This change adds a third Spread test where the source argument is a scalar.
https://reviews.llvm.org/D105837
Files:
flang/unittests/RuntimeGTest/Transformational.cpp
Index: flang/unittests/RuntimeGTest/Transformational.cpp
===================================================================
--- flang/unittests/RuntimeGTest/Transformational.cpp
+++ flang/unittests/RuntimeGTest/Transformational.cpp
@@ -150,6 +150,18 @@
EXPECT_EQ(*result.ZeroBasedIndexedElement<std::int32_t>(j), 1 + j % 3);
}
result.Destroy();
+
+ auto scalar{MakeArray<TypeCategory::Integer, 4>(
+ std::vector<int>{}, std::vector<std::int32_t>{1})};
+ RTNAME(Spread)(result, *scalar, 1, 2, __FILE__, __LINE__);
+ EXPECT_EQ(result.type(), array->type());
+ EXPECT_EQ(result.rank(), 1);
+ EXPECT_EQ(result.GetDimension(0).LowerBound(), 1);
+ EXPECT_EQ(result.GetDimension(0).Extent(), 2);
+ for (int j{0}; j < 2; ++j) {
+ EXPECT_EQ(*result.ZeroBasedIndexedElement<std::int32_t>(j), 1);
+ }
+ result.Destroy();
}
TEST(Transformational, Transpose) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D105837.358038.patch
Type: text/x-patch
Size: 881 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/flang-commits/attachments/20210712/96e9eb05/attachment.bin>
More information about the flang-commits
mailing list