1 #include <gtest/gtest.h>
4 #include "core/InformationManager.hxx"
5 #include "core/BasicBlock.hxx"
6 #include "core/Function.hxx"
8 extern char * TEST_DATA_DIRECTORY
;
10 TEST(FunctionTest
, deserializeValidInstance
) {
11 QFile
file(QString(TEST_DATA_DIRECTORY
) + "/testdata/core/Function/valid.xml");
12 InformationManager manager
;
13 file
.open(QFile::ReadOnly
| QFile::Text
);
14 QXmlStreamReader
reader(&file
);
16 reader
.readNextStartElement();
17 Function
* fun
= Function::deserialize(reader
, &manager
);
19 ASSERT_NE((void*)NULL
, (void*)fun
);
20 EXPECT_STREQ("main", fun
->getName().c_str());
21 EXPECT_EQ(0x403e10, fun
->getStartAddress());
23 EXPECT_STREQ("BLOCK_403e10_403e48", fun
->blocks().find(0x403e10)->second
->getName().c_str());
24 EXPECT_STREQ("BLOCK_403e48_403e50", fun
->blocks().find(0x403e48)->second
->getName().c_str());
25 EXPECT_STREQ("BLOCK_403e50_403e66", fun
->blocks().find(0x403e50)->second
->getName().c_str());
26 EXPECT_STREQ("BLOCK_403e66_403e75", fun
->blocks().find(0x403e66)->second
->getName().c_str());