Skip to content

Commit

Permalink
Add a scalar argument case for the Fortran spread intrinsic unit test.
Browse files Browse the repository at this point in the history
Differential Revision: https://reviews.llvm.org/D105837
  • Loading branch information
mleair committed Jul 16, 2021
1 parent 3f9004c commit abbcec5
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions flang/unittests/RuntimeGTest/Transformational.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,18 @@ TEST(Transformational, Spread) {
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) {
Expand Down

0 comments on commit abbcec5

Please sign in to comment.