14
14
using namespace Fortran ::runtime;
15
15
using Fortran::common::TypeCategory;
16
16
17
- TEST (Inquiry, Lbound ) {
17
+ TEST (Inquiry, LboundDim ) {
18
18
// ARRAY 1 3 5
19
19
// 2 4 6
20
20
auto array{MakeArray<TypeCategory::Integer, 4 >(
@@ -26,6 +26,42 @@ TEST(Inquiry, Lbound) {
26
26
EXPECT_EQ (RTNAME (LboundDim)(*array, 2 , __FILE__, __LINE__), std::int64_t {-1 });
27
27
}
28
28
29
+ TEST (Inquiry, Lbound) {
30
+ // ARRAY 1 3 5
31
+ // 2 4 6
32
+ auto array{MakeArray<TypeCategory::Integer, 4 >(
33
+ std::vector<int >{2 , 3 }, std::vector<std::int32_t >{1 , 2 , 3 , 4 , 5 , 6 })};
34
+ array->GetDimension (0 ).SetLowerBound (0 );
35
+ array->GetDimension (1 ).SetLowerBound (-1 );
36
+
37
+ // LBOUND(ARRAY, KIND=1)
38
+ auto int8Result{
39
+ MakeArray<TypeCategory::Integer, 1 >(std::vector<int >{array->rank ()},
40
+ std::vector<std::int8_t >(array->rank (), 0 ))};
41
+ RTNAME (Lbound)
42
+ (int8Result->raw ().base_addr , *array, /* KIND=*/ 1 , __FILE__, __LINE__);
43
+ EXPECT_EQ (*int8Result->ZeroBasedIndexedElement <std::int8_t >(0 ), 0 );
44
+ EXPECT_EQ (*int8Result->ZeroBasedIndexedElement <std::int8_t >(1 ), -1 );
45
+
46
+ // LBOUND(ARRAY, KIND=4)
47
+ auto int32Result{
48
+ MakeArray<TypeCategory::Integer, 4 >(std::vector<int >{array->rank ()},
49
+ std::vector<std::int32_t >(array->rank (), 0 ))};
50
+ RTNAME (Lbound)
51
+ (int32Result->raw ().base_addr , *array, /* KIND=*/ 4 , __FILE__, __LINE__);
52
+ EXPECT_EQ (*int32Result->ZeroBasedIndexedElement <std::int32_t >(0 ), 0 );
53
+ EXPECT_EQ (*int32Result->ZeroBasedIndexedElement <std::int32_t >(1 ), -1 );
54
+
55
+ // LBOUND(ARRAY, KIND=8)
56
+ auto int64Result{
57
+ MakeArray<TypeCategory::Integer, 8 >(std::vector<int >{array->rank ()},
58
+ std::vector<std::int64_t >(array->rank (), 0 ))};
59
+ RTNAME (Lbound)
60
+ (int64Result->raw ().base_addr , *array, /* KIND=*/ 8 , __FILE__, __LINE__);
61
+ EXPECT_EQ (*int64Result->ZeroBasedIndexedElement <std::int64_t >(0 ), 0 );
62
+ EXPECT_EQ (*int64Result->ZeroBasedIndexedElement <std::int64_t >(1 ), -1 );
63
+ }
64
+
29
65
TEST (Inquiry, Ubound) {
30
66
// ARRAY 1 3 5
31
67
// 2 4 6
0 commit comments