[llvm-branch-commits] [flang] abbcec5 - Add a scalar argument case for the Fortran spread intrinsic unit test.

Mark Leair via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Fri Jul 16 12:36:44 PDT 2021


Author: Mark Leair
Date: 2021-07-16T12:33:51-07:00
New Revision: abbcec5c75969ff78e4aed31b83b869d49ba9d9f

URL: https://github.com/llvm/llvm-project/commit/abbcec5c75969ff78e4aed31b83b869d49ba9d9f
DIFF: https://github.com/llvm/llvm-project/commit/abbcec5c75969ff78e4aed31b83b869d49ba9d9f.diff

LOG: Add a scalar argument case for the Fortran spread intrinsic unit test.

Differential Revision: https://reviews.llvm.org/D105837

Added: 
    

Modified: 
    flang/unittests/RuntimeGTest/Transformational.cpp

Removed: 
    


################################################################################
diff  --git a/flang/unittests/RuntimeGTest/Transformational.cpp b/flang/unittests/RuntimeGTest/Transformational.cpp
index 00495fc04a94d..90c1fa36d9941 100644
--- a/flang/unittests/RuntimeGTest/Transformational.cpp
+++ b/flang/unittests/RuntimeGTest/Transformational.cpp
@@ -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) {


        


More information about the llvm-branch-commits mailing list