HyperDbg/hyperdbg/hyperdbg-test/code/main.cpp

116 lines
2.6 KiB
C++
Raw Permalink Normal View History

2026-08-11 00:23:02 +08:00
/**
* @file main.cpp
* @author Sina Karvandi (sina@hyperdbg.org)
* @brief perform tests
* @details
* @version 0.11
* @date 2024-08-11
*
* @copyright This project is released under the GNU Public License v3.
*
*/
#include "pch.h"
2026-08-11 00:23:02 +08:00
/**
* @brief Main function of test process
*
* @param argc
* @param argv
* @return int
*/
int
2026-08-11 00:23:02 +08:00
main(int argc, char* argv[])
{
if (argc != 2)
{
printf("you should not test functionalities directly, instead use 'test all' "
2026-08-11 00:23:02 +08:00
"command from HyperDbg...\n");
return 1;
}
if (!strcmp(argv[1], TEST_CASE_PARAMETER_FOR_MAIN_COMMAND_PARSER))
{
//
// # Test case 1
// Testing command parser
//
if (TestCommandParser())
{
printf("\n[*] The main command parser test cases passed successfully\n");
}
else
{
2024-10-02 15:04:02 +02:00
printf("\n[x] The main command parser test cases failed\n");
}
}
2026-06-02 11:20:05 +01:00
else if (!strcmp(argv[1], TEST_CASE_PARAMETER_FOR_PE_PARSER))
{
//
// # Test case 2
2026-06-02 11:20:05 +01:00
// Testing PE parser helpers
//
if (TestPeParser())
{
printf("\n[*] The PE parser test cases passed successfully\n");
}
else
{
printf("\n[x] The PE parser test cases failed\n");
}
}
else if (!strcmp(argv[1], TEST_CASE_PARAMETER_FOR_SCRIPT_SEMANTIC_TEST_CASES))
{
//
// # Test case 3
// Testing script semantic test cases
//
if (TestSemanticScripts())
{
printf("\n[*] The script semantic test cases passed successfully\n");
}
else
{
2024-10-02 15:04:02 +02:00
printf("\n[x] The script semantic test cases failed\n");
}
}
else if (!strcmp(argv[1], TEST_CASE_PARAMETER_FOR_CODEVIEW_RSDS_PARSER))
{
//
// # Test case 4
// Testing CodeView RSDS parser helpers
//
if (TestCodeViewRsdsParser())
{
printf("\n[*] The CodeView RSDS parser test cases passed successfully\n");
}
else
{
printf("\n[x] The CodeView RSDS parser test cases failed\n");
}
}
2024-10-02 15:04:02 +02:00
else if (!strcmp(argv[1], TEST_HWDBG_FUNCTIONALITIES))
{
//
// # Test hwdbg functionalities
//
if (HwdbgTestCreateTestCases())
{
printf("\n[*] The hwdbg test cases passed successfully\n");
}
else
{
printf("\n[x] The hwdbg test cases failed\n");
}
}
else
{
printf("unknown test case\n");
}
2026-08-11 00:23:02 +08:00
printf("\npress any key to exit...");
_getch();
return 0;
}