| 1 |
//===- unittest/Support/BitstreamRemarksFormatTest.cpp - BitCodes tests ---===// |
| 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 |
//===----------------------------------------------------------------------===// |
| 8 |
|
| 9 |
#include "llvm/Remarks/BitstreamRemarkContainer.h" |
| 10 |
#include "gtest/gtest.h" |
| 11 |
|
| 12 |
using namespace llvm; |
| 13 |
|
| 14 |
// The goal for this test is to observe test failures and carefully update the |
| 15 |
// constants when they change. |
| 16 |
|
| 17 |
// This should not change over time. |
| 18 |
TEST(BitstreamRemarksFormat, Magic) { |
| 19 |
EXPECT_EQ(remarks::ContainerMagic, "RMRK"); |
| 20 |
} |
| 21 |
|
| 22 |
// This should be updated whenever any of the tests below are modified. |
| 23 |
TEST(BitstreamRemarksFormat, ContainerVersion) { |
| 24 |
EXPECT_EQ(remarks::CurrentContainerVersion, 0UL); |
| 25 |
} |
| 26 |
|
| 27 |
// The values of the current blocks should not change over time. |
| 28 |
// When adding new blocks, make sure to append them to the enum. |
| 29 |
TEST(BitstreamRemarksFormat, BlockIDs) { |
| 30 |
EXPECT_EQ(remarks::META_BLOCK_ID, 8); |
| 31 |
EXPECT_EQ(remarks::REMARK_BLOCK_ID, 9); |
| 32 |
} |
| 33 |
|
| 34 |
// The values of the current records should not change over time. |
| 35 |
// When adding new records, make sure to append them to the enum. |
| 36 |
TEST(BitstreamRemarksFormat, RecordIDs) { |
| 37 |
EXPECT_EQ(remarks::RECORD_FIRST, 1); |
| 38 |
EXPECT_EQ(remarks::RECORD_META_CONTAINER_INFO, 1); |
| 39 |
EXPECT_EQ(remarks::RECORD_META_REMARK_VERSION, 2); |
| 40 |
EXPECT_EQ(remarks::RECORD_META_STRTAB, 3); |
| 41 |
EXPECT_EQ(remarks::RECORD_META_EXTERNAL_FILE, 4); |
| 42 |
EXPECT_EQ(remarks::RECORD_REMARK_HEADER, 5); |
| 43 |
EXPECT_EQ(remarks::RECORD_REMARK_DEBUG_LOC, 6); |
| 44 |
EXPECT_EQ(remarks::RECORD_REMARK_HOTNESS, 7); |
| 45 |
EXPECT_EQ(remarks::RECORD_REMARK_ARG_WITH_DEBUGLOC, 8); |
| 46 |
EXPECT_EQ(remarks::RECORD_REMARK_ARG_WITHOUT_DEBUGLOC, 9); |
| 47 |
EXPECT_EQ(remarks::RECORD_LAST, 9); |
| 48 |
} |