Commit 19d3d389 authored by ussrhero's avatar ussrhero

renamed h test case to cpp

parent 6f96e046
#pragma once
#include <stdafx.h>
#include "kdlib/breakpoint.h"
......
#pragma once
#include <stdafx.h>
#include "procfixture.h"
......
#pragma once
#include <stdafx.h>
#include "procfixture.h"
#include "kdlib/cpucontext.h"
......
#pragma once
#include <stdafx.h>
#include "gtest/gtest.h"
#include "kdlib/kdlib.h"
#include "kdlib/typedvar.h"
using namespace kdlib;
#include "procfixture.h"
......
#pragma once
#include <stdafx.h>
#include "procfixture.h"
#include "kdlib/disasm.h"
......
#pragma once
#include <stdafx.h>
#include "basefixture.h"
#include "eventhandlermock.h"
......
......@@ -4,27 +4,6 @@
#include "stdafx.h"
#include "gmock/gmock.h"
#include "kdlib/dbgengine.h"
#include "eventhandlertest.h"
#include "processtest.h"
#include "moduletest.h"
#include "memorytest.h"
#include "typeinfotest.h"
#include "typedvartest.h"
#include "varianttest.h"
#include "breakhandler.h"
#include "cputest.h"
#include "stacktest.h"
#include "disasmtest.h"
#include "targettest.h"
#include "winapitest.h"
#include "crttest.h"
#include "clangtest.h"
#include "nettest.h"
#include "taggedtest.h"
#ifdef _M_AMD64
#include "regtest_x64.h"
#endif
class Environment : public ::testing::Environment {
public:
......
......@@ -181,43 +181,43 @@
<ItemGroup>
<ClInclude Include="..\..\include\test\testvars.h" />
<ClInclude Include="basefixture.h" />
<ClInclude Include="breakhandler.h" />
<ClInclude Include="clangtest.h" />
<ClInclude Include="cputest.h" />
<ClInclude Include="crttest.h" />
<ClInclude Include="disasmtest.h" />
<ClInclude Include="eventhandlermock.h" />
<ClInclude Include="eventhandlertest.h" />
<ClInclude Include="memdumpfixture.h" />
<ClInclude Include="memorytest.h" />
<ClInclude Include="moduletest.h" />
<ClInclude Include="nettest.h" />
<ClInclude Include="processtest.h" />
<ClInclude Include="procfixture.h" />
<ClInclude Include="regtest_x64.h" />
<ClInclude Include="stacktest.h" />
<ClInclude Include="stdafx.h" />
<ClInclude Include="taggedtest.h" />
<ClInclude Include="targettest.h" />
<ClInclude Include="targetver.h" />
<ClInclude Include="typedvartest.h" />
<ClInclude Include="typeinfotest.h" />
<ClInclude Include="varianttest.h" />
<ClInclude Include="winapitest.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\comdate\testfunc.cpp" />
<ClCompile Include="..\comdate\testvars.cpp" />
<ClCompile Include="breakhandler.cpp" />
<ClCompile Include="clangtest.cpp" />
<ClCompile Include="cputest.cpp" />
<ClCompile Include="crttest.cpp" />
<ClCompile Include="disasmtest.cpp" />
<ClCompile Include="eventhandlertest.cpp" />
<ClCompile Include="googlemock\src\gmock-all.cc">
<PrecompiledHeader>NotUsing</PrecompiledHeader>
</ClCompile>
<ClCompile Include="googletest\src\gtest-all.cc">
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
</ClCompile>
<ClCompile Include="kdlibtest.cpp" />
<ClCompile Include="memorytest.cpp" />
<ClCompile Include="moduletest.cpp" />
<ClCompile Include="nettest.cpp" />
<ClCompile Include="processtest.cpp" />
<ClCompile Include="regtest_x64.cpp" />
<ClCompile Include="stacktest.cpp" />
<ClCompile Include="stdafx.cpp">
<PrecompiledHeader>Create</PrecompiledHeader>
</ClCompile>
<ClCompile Include="taggedtest.cpp" />
<ClCompile Include="targettest.cpp" />
<ClCompile Include="typedvartest.cpp" />
<ClCompile Include="typeinfotest.cpp" />
<ClCompile Include="varianttest.cpp" />
<ClCompile Include="winapitest.cpp" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\source\kdlib.vcxproj">
......
......@@ -11,79 +11,79 @@
</ClCompile>
<ClCompile Include="googletest\src\gtest-all.cc" />
<ClCompile Include="googlemock\src\gmock-all.cc" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="stdafx.h" />
<ClInclude Include="targetver.h" />
<ClInclude Include="breakhandler.h">
<ClCompile Include="breakhandler.cpp">
<Filter>testcases</Filter>
</ClInclude>
<ClInclude Include="cputest.h">
</ClCompile>
<ClCompile Include="clangtest.cpp">
<Filter>testcases</Filter>
</ClInclude>
<ClInclude Include="memorytest.h">
</ClCompile>
<ClCompile Include="cputest.cpp">
<Filter>testcases</Filter>
</ClInclude>
<ClInclude Include="moduletest.h">
</ClCompile>
<ClCompile Include="crttest.cpp">
<Filter>testcases</Filter>
</ClInclude>
<ClInclude Include="stacktest.h">
</ClCompile>
<ClCompile Include="disasmtest.cpp">
<Filter>testcases</Filter>
</ClInclude>
</ClCompile>
<ClCompile Include="eventhandlertest.cpp">
<Filter>testcases</Filter>
</ClCompile>
<ClCompile Include="memorytest.cpp">
<Filter>testcases</Filter>
</ClCompile>
<ClCompile Include="moduletest.cpp">
<Filter>testcases</Filter>
</ClCompile>
<ClCompile Include="nettest.cpp">
<Filter>testcases</Filter>
</ClCompile>
<ClCompile Include="processtest.cpp">
<Filter>testcases</Filter>
</ClCompile>
<ClCompile Include="regtest_x64.cpp">
<Filter>testcases</Filter>
</ClCompile>
<ClCompile Include="stacktest.cpp">
<Filter>testcases</Filter>
</ClCompile>
<ClCompile Include="taggedtest.cpp">
<Filter>testcases</Filter>
</ClCompile>
<ClCompile Include="targettest.cpp">
<Filter>testcases</Filter>
</ClCompile>
<ClCompile Include="typedvartest.cpp">
<Filter>testcases</Filter>
</ClCompile>
<ClCompile Include="typeinfotest.cpp">
<Filter>testcases</Filter>
</ClCompile>
<ClCompile Include="varianttest.cpp">
<Filter>testcases</Filter>
</ClCompile>
<ClCompile Include="winapitest.cpp">
<Filter>testcases</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="stdafx.h" />
<ClInclude Include="targetver.h" />
<ClInclude Include="..\..\include\test\testvars.h">
<Filter>testdata</Filter>
</ClInclude>
<ClInclude Include="processtest.h">
<Filter>testcases</Filter>
</ClInclude>
<ClInclude Include="procfixture.h">
<Filter>testfixtures</Filter>
</ClInclude>
<ClInclude Include="varianttest.h">
<Filter>testcases</Filter>
</ClInclude>
<ClInclude Include="typeinfotest.h">
<Filter>testcases</Filter>
</ClInclude>
<ClInclude Include="typedvartest.h">
<Filter>testcases</Filter>
</ClInclude>
<ClInclude Include="basefixture.h">
<Filter>testfixtures</Filter>
</ClInclude>
<ClInclude Include="eventhandlertest.h">
<Filter>testcases</Filter>
</ClInclude>
<ClInclude Include="eventhandlermock.h">
<Filter>testfixtures</Filter>
</ClInclude>
<ClInclude Include="disasmtest.h">
<Filter>testcases</Filter>
</ClInclude>
<ClInclude Include="targettest.h">
<Filter>testcases</Filter>
</ClInclude>
<ClInclude Include="memdumpfixture.h">
<Filter>testfixtures</Filter>
</ClInclude>
<ClInclude Include="winapitest.h">
<Filter>testcases</Filter>
</ClInclude>
<ClInclude Include="crttest.h">
<Filter>testcases</Filter>
</ClInclude>
<ClInclude Include="regtest_x64.h">
<Filter>testcases</Filter>
</ClInclude>
<ClInclude Include="clangtest.h">
<Filter>testcases</Filter>
</ClInclude>
<ClInclude Include="nettest.h">
<Filter>testcases</Filter>
</ClInclude>
<ClInclude Include="taggedtest.h">
<Filter>testcases</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
......
#pragma once
#include <stdafx.h>
#include "procfixture.h"
#include "kdlib/memaccess.h"
......@@ -258,16 +258,16 @@ TEST_F(MemoryTest, InvalidBigRegion)
TEST_F(MemoryTest, testPartial)
{
const auto delta = sizeof(ULONGLONG) / 2;
const auto delta = sizeof(unsigned long long) / 2;
const MEMOFFSET_64 offset = m_targetModule->getEnd() - delta;
EXPECT_THROW(loadBytes(offset, sizeof(ULONGLONG)), MemoryException);
EXPECT_THROW(loadBytes(offset, sizeof(unsigned long long)), MemoryException);
EXPECT_THROW(ptrQWord(offset), MemoryException);
EXPECT_THROW(writeBytes(offset, std::vector<unsigned char>(sizeof(ULONGLONG))), MemoryException);
EXPECT_THROW(writeBytes(offset, std::vector<unsigned char>(sizeof(unsigned long long))), MemoryException);
EXPECT_THROW(setQWord(offset, 0), MemoryException);
ULONGLONG tmp;
unsigned long long tmp;
unsigned long readed = 0;
EXPECT_NO_THROW( readMemory(offset, &tmp, sizeof(tmp), false, &readed) );
EXPECT_EQ( delta, readed );
......
#pragma once
#include <stdafx.h>
#include <boost/bind.hpp>
......
#pragma once
#include <stdafx.h>
#include "procfixture.h"
#include "kdlib/heap.h"
#include "kdlib/kdlib.h"
using namespace kdlib;
class NetTest : public NetProcessFixture
{
......
#pragma once
#include <stdafx.h>
#include <vector>
#include <sstream>
......
#pragma once
#include <stdafx.h>
#ifdef _M_AMD64
#include "procfixture.h"
......@@ -32,4 +34,4 @@ TEST_F(RegTest, RegisterAccessor)
EXPECT_THROW(getRegisterAccessor(L"RAX"), CPUException);
}
#endif
\ No newline at end of file
#pragma once
#include <stdafx.h>
#include <math.h>
#include "procfixture.h"
#include "eventhandlermock.h"
#include "kdlib/stack.h"
#include "kdlib/memaccess.h"
#include "kdlib/kdlib.h"
using namespace kdlib;
......
#pragma once
#include <stdafx.h>
#include "memdumpfixture.h"
......
#pragma once
#include <stdafx.h>
#include "basefixture.h"
#include "memdumpfixture.h"
......
#pragma once
#include <stdafx.h>
#include "procfixture.h"
#include "kdlib/typedvar.h"
#include "kdlib/exceptions.h"
#include "kdlib/cpucontext.h"
#include "kdlib/kdlib.h"
#include "test/testvars.h"
#include "test/testfunc.h"
......
#pragma once
#include <stdafx.h>
#include <windows.h>
#include "gtest/gtest.h"
#include "kdlib/module.h"
#include "kdlib/kdlib.h"
#include "procfixture.h"
using namespace kdlib;
class WinApiTest : public ProcessFixture
{
public:
......@@ -28,7 +32,7 @@ TEST_F(WinApiTest, CreateFileCall)
{
kdlib::ModulePtr kernel32;
ASSERT_NO_THROW( kernel32 = kdlib::loadModule(L"kernel32") );
ASSERT_NO_THROW( kernel32 = loadModule(L"kernel32") );
ASSERT_NE( 0, kernel32->asULongLong() );
kdlib::MEMOFFSET_64 createFileOffset;
......@@ -37,28 +41,28 @@ TEST_F(WinApiTest, CreateFileCall)
ASSERT_NE(0, createFileOffset );
TypeInfoPtr HANDLE_Type;
ASSERT_NO_THROW(HANDLE_Type = kdlib::loadType(L"Void*"));
ASSERT_NO_THROW(HANDLE_Type = loadType(L"Void*"));
TypeInfoPtr CreateFile_Type;
ASSERT_NO_THROW( CreateFile_Type = kdlib::defineFunction( HANDLE_Type, kdlib::CallConv_NearStd) );
ASSERT_NO_THROW( CreateFile_Type->appendField(L"lpFileName", kdlib::loadType(L"WChar*") ) );
ASSERT_NO_THROW( CreateFile_Type->appendField(L"dwDesiredAccess", kdlib::loadType(L"UInt4B") ) );
ASSERT_NO_THROW( CreateFile_Type->appendField(L"dwShareMode", kdlib::loadType(L"UInt4B") ) );
ASSERT_NO_THROW( CreateFile_Type->appendField(L"lpSecurityAttributes", kdlib::loadType(L"Void*") ) );
ASSERT_NO_THROW( CreateFile_Type->appendField(L"dwCreationDisposition", kdlib::loadType(L"UInt4B") ) );
ASSERT_NO_THROW( CreateFile_Type->appendField(L"dwFlagsAndAttributes", kdlib::loadType(L"UInt4B") ) );
ASSERT_NO_THROW( CreateFile_Type = kdlib::defineFunction( HANDLE_Type, CallConv_NearStd) );
ASSERT_NO_THROW( CreateFile_Type->appendField(L"lpFileName", loadType(L"WChar*") ) );
ASSERT_NO_THROW( CreateFile_Type->appendField(L"dwDesiredAccess", loadType(L"UInt4B") ) );
ASSERT_NO_THROW( CreateFile_Type->appendField(L"dwShareMode", loadType(L"UInt4B") ) );
ASSERT_NO_THROW( CreateFile_Type->appendField(L"lpSecurityAttributes", loadType(L"Void*") ) );
ASSERT_NO_THROW( CreateFile_Type->appendField(L"dwCreationDisposition", loadType(L"UInt4B") ) );
ASSERT_NO_THROW( CreateFile_Type->appendField(L"dwFlagsAndAttributes", loadType(L"UInt4B") ) );
ASSERT_NO_THROW( CreateFile_Type->appendField(L"hTemplateFile", HANDLE_Type ) );
MEMOFFSET_64 fileNameBuf;
ASSERT_NO_THROW( fileNameBuf= kdlib::stackAlloc(100) );
ASSERT_NO_THROW( fileNameBuf= stackAlloc(100) );
const wchar_t* fileNameStr = L"testfile.txt";
std::vector<unsigned short> fileName( fileNameStr, fileNameStr + wcslen(fileNameStr) + 1 );
ASSERT_NO_THROW( kdlib::writeWords( fileNameBuf, fileName ) );
ASSERT_NO_THROW( writeWords( fileNameBuf, fileName ) );
TypedVarPtr CreateFilePtr;
ASSERT_NO_THROW( CreateFilePtr = kdlib::loadTypedVar(CreateFile_Type, createFileOffset) );
ASSERT_NO_THROW( CreateFilePtr = loadTypedVar(CreateFile_Type, createFileOffset) );
HANDLE fileHandle = INVALID_HANDLE_VALUE;
......@@ -87,15 +91,15 @@ TEST_F(WinApiTest, CreateFileCall)
EXPECT_NE( INVALID_HANDLE_VALUE, fileHandle );
EXPECT_NO_THROW( kdlib::stackFree(100) );
EXPECT_NO_THROW( stackFree(100) );
}
TEST_F(WinApiTest, CreateFileCallClang)
{
kdlib::ModulePtr kernel32;
ASSERT_NO_THROW( kernel32 = kdlib::loadModule(L"kernel32") );
ModulePtr kernel32;
ASSERT_NO_THROW( kernel32 = loadModule(L"kernel32") );
kdlib::MEMOFFSET_64 createFileOffset;
MEMOFFSET_64 createFileOffset;
ASSERT_NO_THROW( createFileOffset = kernel32->getSymbolVa(L"CreateFileW") );
std::wstring src = L"#include <windows.h>\r\n";
......@@ -103,17 +107,17 @@ TEST_F(WinApiTest, CreateFileCallClang)
-I\"C:/Program Files (x86)/Windows Kits/8.1/Include/shared\" -w";
MEMOFFSET_64 fileNameBuf;
ASSERT_NO_THROW( fileNameBuf= kdlib::stackAlloc(100) );
ASSERT_NO_THROW( fileNameBuf= stackAlloc(100) );
const wchar_t* fileNameStr = L"testfile1.txt";
std::vector<unsigned short> fileName( fileNameStr, fileNameStr + wcslen(fileNameStr) + 1 );
ASSERT_NO_THROW( kdlib::writeWords( fileNameBuf, fileName ) );
ASSERT_NO_THROW( writeWords( fileNameBuf, fileName ) );
TypeInfoPtr CreateFile_Type;
ASSERT_NO_THROW( CreateFile_Type = kdlib::compileType(src, L"CreateFileW", opt) );
ASSERT_NO_THROW( CreateFile_Type = compileType(src, L"CreateFileW", opt) );
TypedVarPtr CreateFilePtr;
ASSERT_NO_THROW( CreateFilePtr = kdlib::loadTypedVar(CreateFile_Type, createFileOffset) );
ASSERT_NO_THROW( CreateFilePtr = loadTypedVar(CreateFile_Type, createFileOffset) );
HANDLE fileHandle = INVALID_HANDLE_VALUE;
......@@ -142,6 +146,6 @@ TEST_F(WinApiTest, CreateFileCallClang)
EXPECT_NE( INVALID_HANDLE_VALUE, fileHandle );
EXPECT_NO_THROW( kdlib::stackFree(100) );
EXPECT_NO_THROW( stackFree(100) );
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment