clang-tools  11.0.0
RIFFTests.cpp
Go to the documentation of this file.
1 //===-- RIFFTests.cpp - Binary container unit 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 "RIFF.h"
10 #include "gmock/gmock.h"
11 #include "gtest/gtest.h"
12 
13 namespace clang {
14 namespace clangd {
15 namespace {
16 using ::testing::ElementsAre;
17 
18 TEST(RIFFTest, File) {
19  riff::File File{riff::fourCC("test"),
20  {
21  {riff::fourCC("even"), "abcd"},
22  {riff::fourCC("oddd"), "abcde"},
23  }};
24  llvm::StringRef Serialized = llvm::StringRef("RIFF\x1e\0\0\0test"
25  "even\x04\0\0\0abcd"
26  "oddd\x05\0\0\0abcde\0",
27  38);
28 
29  EXPECT_EQ(llvm::to_string(File), Serialized);
30  auto Parsed = riff::readFile(Serialized);
31  ASSERT_TRUE(bool(Parsed)) << Parsed.takeError();
32  EXPECT_EQ(*Parsed, File);
33 }
34 
35 } // namespace
36 } // namespace clangd
37 } // namespace clang
clang::clangd::riff::fourCC
constexpr FourCC fourCC(const char(&Literal)[5])
Definition: RIFF.h:44
clang::clangd::TEST
TEST(BackgroundQueueTest, Priority)
Definition: BackgroundIndexTests.cpp:704
RIFF.h
clang::clangd::riff::readFile
llvm::Expected< File > readFile(llvm::StringRef Stream)
Definition: RIFF.cpp:55
clang
===– Representation.cpp - ClangDoc Representation --------—*- C++ -*-===//
Definition: ApplyReplacements.h:27