clang-tools 20.0.0git
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 "llvm/Support/ScopedPrinter.h"
11#include "gmock/gmock.h"
12#include "gtest/gtest.h"
13
14namespace clang {
15namespace clangd {
16namespace {
17
18TEST(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
llvm::Expected< File > readFile(llvm::StringRef Stream)
Definition: RIFF.cpp:48
constexpr FourCC fourCC(const char(&Literal)[5])
Definition: RIFF.h:43
TEST(BackgroundQueueTest, Priority)
===– Representation.cpp - ClangDoc Representation --------—*- C++ -*-===//