-
Notifications
You must be signed in to change notification settings - Fork 122
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #56 from Eran-YT/Add-tests
Add more tests & Use warning level 4
- Loading branch information
Showing
7 changed files
with
82 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,4 +5,6 @@ | |
|
||
#pragma once | ||
|
||
#pragma warning(push, 3) | ||
#include "gtest/gtest.h" | ||
#pragma warning(pop) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,57 @@ | ||
#include "pch.h" | ||
|
||
|
||
|
||
#include "../../source/RaccineLib/HandleWrapper.h" | ||
#include "../../source/RaccineLib/Raccine.h" | ||
#include "../../source/RaccineLib/Utils.h" | ||
|
||
TEST(TestUtils, ToLower) | ||
{ | ||
const std::wstring input = L"HellO WoRld"; | ||
std::wstring excepted_output = L"hello world"; | ||
EXPECT_EQ(excepted_output, utils::to_lower(input)); | ||
} | ||
} | ||
|
||
TEST(TestGetImageName, System) | ||
{ | ||
std::wstring image_name = getImageName(4); | ||
ASSERT_EQ(image_name, L"System"); | ||
} | ||
|
||
TEST(TestGetImageName, NonExistant) | ||
{ | ||
std::wstring image_name = getImageName(3); | ||
ASSERT_EQ(image_name, L"(unavailable)"); | ||
} | ||
|
||
TEST(TestGetImageName, CurrentProcess) | ||
{ | ||
std::wstring image_name = getImageName(GetCurrentProcessId()); | ||
ASSERT_EQ(image_name, L"Raccine-Test.exe"); | ||
} | ||
|
||
TEST(TestGetParentPid, System) | ||
{ | ||
DWORD parent_pid = getParentPid(4); | ||
ASSERT_EQ(parent_pid, 0); | ||
} | ||
|
||
TEST(TestGetParentPid, NonExistant) | ||
{ | ||
DWORD parent_pid = getParentPid(3); | ||
ASSERT_EQ(parent_pid, 0); | ||
} | ||
|
||
TEST(TestGetIntegrityLevel, CurrentProcess) | ||
{ | ||
ProcessHandleWrapper hProcess = OpenProcess(PROCESS_QUERY_LIMITED_INFORMATION, | ||
FALSE, | ||
GetCurrentProcessId()); | ||
if (!hProcess) { | ||
FAIL() << "Failed to open process"; | ||
} | ||
|
||
Integrity integrity = getIntegrityLevel(hProcess); | ||
ASSERT_EQ(integrity, Integrity::Medium); | ||
} |