[obj2yaml] - Stop triggering UB when dumping corrupted strings.
[llvm-complete.git] / unittests / Remarks / BitstreamRemarksFormatTest.cpp
blobea61691f4c8356a1fcbce3e4f35e908611000f28
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 //===----------------------------------------------------------------------===//
9 #include "llvm/Remarks/BitstreamRemarkContainer.h"
10 #include "gtest/gtest.h"
12 using namespace llvm;
14 // The goal for this test is to observe test failures and carefully update the
15 // constants when they change.
17 // This should not change over time.
18 TEST(BitstreamRemarksFormat, Magic) {
19 EXPECT_EQ(remarks::ContainerMagic, "RMRK");
22 // This should be updated whenever any of the tests below are modified.
23 TEST(BitstreamRemarksFormat, ContainerVersion) {
24 EXPECT_EQ(remarks::CurrentContainerVersion, 0UL);
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);
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);