]> git.siccegge.de Git - frida/frida.git/blob - src/core/tests/FunctionTest.cxx
Cleanup
[frida/frida.git] / src / core / tests / FunctionTest.cxx
1 #include <gtest/gtest.h>
2
3 #include "gui/qt.hxx"
4 #include "core/InformationManager.hxx"
5 #include "core/BasicBlock.hxx"
6 #include "core/Function.hxx"
7
8 extern char * TEST_DATA_DIRECTORY;
9
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);
15
16 reader.readNextStartElement();
17 Function* fun = Function::deserialize(reader, &manager);
18
19 ASSERT_NE((void*)NULL, (void*)fun);
20 EXPECT_STREQ("main", fun->getName().c_str());
21 EXPECT_EQ(0x403e10, fun->getStartAddress());
22
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());
27 }
28