[clang][modules] Don't prevent translation of FW_Private includes when explicitly...
[llvm-project.git] / flang / unittests / Runtime / Ragged.cpp
blob4b261b14789c47078960056a18c91ebcc4d7016c
1 //===-- flang/unittests/Runtime/Ragged.cpp ----------------------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
9 #include "flang/Runtime/ragged.h"
10 #include "gtest/gtest.h"
12 using namespace Fortran::runtime;
14 TEST(Ragged, RaggedArrayAllocateDeallocateTest) {
15 struct RaggedArrayHeader header;
16 unsigned rank = 2;
17 int64_t *extents = new int64_t[2];
18 extents[0] = 10;
19 extents[1] = 100;
20 RaggedArrayHeader *ret = (RaggedArrayHeader *)_FortranARaggedArrayAllocate(
21 &header, false, rank, 32, extents);
22 EXPECT_TRUE(ret != nullptr);
23 EXPECT_TRUE(ret->bufferPointer != nullptr);
24 EXPECT_EQ(extents, ret->extentPointer);
25 EXPECT_EQ(10, ret->extentPointer[0]);
26 EXPECT_EQ(100, ret->extentPointer[1]);
27 EXPECT_EQ(rank, ret->flags >> 1);
28 EXPECT_FALSE(ret->flags & 1);
30 _FortranARaggedArrayDeallocate(ret);
31 EXPECT_EQ(0u, ret->flags);