]> git.siccegge.de Git - frida/frida.git/blob - src/core/tests/FunctionTest.cxx
Add support for deserializing functions
[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 TEST(FunctionTest, deserializeValidInstance) {
9 QFile file("testdata/core/Function/valid.xml");
10 InformationManager manager;
11 file.open(QFile::ReadOnly | QFile::Text);
12 QXmlStreamReader reader(&file);
13
14 reader.readNextStartElement();
15 Function* fun = Function::deserialize(reader, &manager);
16
17 ASSERT_NE((void*)NULL, (void*)fun);
18 EXPECT_STREQ("main", fun->getName().c_str());
19 EXPECT_EQ(0x403e10, fun->getStartAddress());
20
21 EXPECT_STREQ("BLOCK_403e10_403e48", fun->blocks().find(0x403e10)->second->getName().c_str());
22 EXPECT_STREQ("BLOCK_403e48_403e50", fun->blocks().find(0x403e48)->second->getName().c_str());
23 EXPECT_STREQ("BLOCK_403e50_403e66", fun->blocks().find(0x403e50)->second->getName().c_str());
24 EXPECT_STREQ("BLOCK_403e66_403e75", fun->blocks().find(0x403e66)->second->getName().c_str());
25 }
26