|
7 | 7 | //===----------------------------------------------------------------------===// |
8 | 8 |
|
9 | 9 | #include "llvm/Object/DXContainer.h" |
| 10 | +#include "../../tools/obj2yaml/dxcontainer2yaml.cpp" |
| 11 | +#include "llvm/ADT/SmallString.h" |
10 | 12 | #include "llvm/ADT/StringRef.h" |
11 | 13 | #include "llvm/BinaryFormat/Magic.h" |
12 | 14 | #include "llvm/ObjectYAML/DXContainerYAML.h" |
13 | 15 | #include "llvm/ObjectYAML/yaml2obj.h" |
14 | 16 | #include "llvm/Support/MemoryBufferRef.h" |
15 | 17 | #include "llvm/Testing/Support/Error.h" |
| 18 | +#include "gmock/gmock.h" |
16 | 19 | #include "gtest/gtest.h" |
17 | 20 |
|
18 | 21 | using namespace llvm; |
@@ -907,4 +910,24 @@ TEST(RootSignature, ParseRootConstant) { |
907 | 910 | ASSERT_EQ(Constants->RegisterSpace, 14u); |
908 | 911 | ASSERT_EQ(Constants->Num32BitValues, 16u); |
909 | 912 | } |
| 913 | + { |
| 914 | + uint8_t Buffer[] = { |
| 915 | + 0x44, 0x58, 0x42, 0x43, 0x32, 0x9a, 0x53, 0xd8, 0xec, 0xbe, 0x35, 0x6f, |
| 916 | + 0x05, 0x39, 0xe1, 0xfe, 0x31, 0x20, 0xf0, 0xc1, 0x01, 0x00, 0x00, 0x00, |
| 917 | + 0x85, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, |
| 918 | + 0x52, 0x54, 0x53, 0x30, 0x59, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, |
| 919 | + 0x01, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 920 | + 0x2c, 0x00, 0x00, 0x00, 0x11, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, |
| 921 | + 0x02, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, |
| 922 | + 0x0e, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 923 | + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 924 | + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 925 | + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
| 926 | + 0x00}; |
| 927 | + |
| 928 | + SmallString<256> Storage; |
| 929 | + raw_svector_ostream OS(Storage); |
| 930 | + EXPECT_THAT_ERROR(dxcontainer2yaml(OS, getMemoryBuffer<133>(Buffer)), |
| 931 | + FailedWithMessage("Invalid value for parameter type")); |
| 932 | + } |
910 | 933 | } |
0 commit comments