1 //===-- RIFFTests.cpp - Binary container unit tests -----------------------===//
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
7 //===----------------------------------------------------------------------===//
10 #include "llvm/Support/ScopedPrinter.h"
11 #include "gmock/gmock.h"
12 #include "gtest/gtest.h"
18 TEST(RIFFTest
, File
) {
19 riff::File File
{riff::fourCC("test"),
21 {riff::fourCC("even"), "abcd"},
22 {riff::fourCC("oddd"), "abcde"},
24 llvm::StringRef Serialized
= llvm::StringRef("RIFF\x1e\0\0\0test"
26 "oddd\x05\0\0\0abcde\0",
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
);