DIEHashTest.cpp revision 800a8761285a239bb82f7d1883a8398815cd2d8f
1800a8761285a239bb82f7d1883a8398815cd2d8fEric Christopher//===- llvm/unittest/DebugInfo/DWARFFormValueTest.cpp ---------------------===//
2800a8761285a239bb82f7d1883a8398815cd2d8fEric Christopher//
3800a8761285a239bb82f7d1883a8398815cd2d8fEric Christopher//                     The LLVM Compiler Infrastructure
4800a8761285a239bb82f7d1883a8398815cd2d8fEric Christopher//
5800a8761285a239bb82f7d1883a8398815cd2d8fEric Christopher// This file is distributed under the University of Illinois Open Source
6800a8761285a239bb82f7d1883a8398815cd2d8fEric Christopher// License. See LICENSE.TXT for details.
7800a8761285a239bb82f7d1883a8398815cd2d8fEric Christopher//
8800a8761285a239bb82f7d1883a8398815cd2d8fEric Christopher//===----------------------------------------------------------------------===//
9800a8761285a239bb82f7d1883a8398815cd2d8fEric Christopher
10800a8761285a239bb82f7d1883a8398815cd2d8fEric Christopher#include "../lib/CodeGen/AsmPrinter/DIE.h"
11800a8761285a239bb82f7d1883a8398815cd2d8fEric Christopher#include "../lib/CodeGen/AsmPrinter/DIEHash.h"
12800a8761285a239bb82f7d1883a8398815cd2d8fEric Christopher#include "llvm/Support/Dwarf.h"
13800a8761285a239bb82f7d1883a8398815cd2d8fEric Christopher#include "llvm/Support/Debug.h"
14800a8761285a239bb82f7d1883a8398815cd2d8fEric Christopher#include "llvm/Support/Format.h"
15800a8761285a239bb82f7d1883a8398815cd2d8fEric Christopher#include "gtest/gtest.h"
16800a8761285a239bb82f7d1883a8398815cd2d8fEric Christopher
17800a8761285a239bb82f7d1883a8398815cd2d8fEric Christophernamespace {
18800a8761285a239bb82f7d1883a8398815cd2d8fEric Christopher
19800a8761285a239bb82f7d1883a8398815cd2d8fEric Christopherusing namespace llvm;
20800a8761285a239bb82f7d1883a8398815cd2d8fEric ChristopherTEST(DIEHashData1Test, DIEHash) {
21800a8761285a239bb82f7d1883a8398815cd2d8fEric Christopher  DIEHash Hash;
22800a8761285a239bb82f7d1883a8398815cd2d8fEric Christopher  DIE *Die = new DIE(dwarf::DW_TAG_base_type);
23800a8761285a239bb82f7d1883a8398815cd2d8fEric Christopher  DIEValue *Size = new DIEInteger(4);
24800a8761285a239bb82f7d1883a8398815cd2d8fEric Christopher  Die->addValue(dwarf::DW_AT_byte_size, dwarf::DW_FORM_data1, Size);
25800a8761285a239bb82f7d1883a8398815cd2d8fEric Christopher  uint64_t MD5Res = Hash.computeTypeSignature(Die);
26800a8761285a239bb82f7d1883a8398815cd2d8fEric Christopher  ASSERT_TRUE(MD5Res == 0x540e9ff30ade3e4a);
27800a8761285a239bb82f7d1883a8398815cd2d8fEric Christopher  delete Die;
28800a8761285a239bb82f7d1883a8398815cd2d8fEric Christopher}
29800a8761285a239bb82f7d1883a8398815cd2d8fEric Christopher}
30