-
Notifications
You must be signed in to change notification settings - Fork 0
Add unit tests projects to projects missing them #81
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Changes from 2 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
9e7f205
Drop atl dep
X-rays5 90fb03d
Add unit test base to injector and menu
X-rays5 756c954
Update injector/test/CMakeLists.txt
X-rays5 0e3ce76
Update menu/test/CMakeLists.txt
X-rays5 1ab2d2b
Update menu/CMakeLists.txt
X-rays5 4dc6cb0
Fix comments
X-rays5 6486d4d
Fix build
X-rays5 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| // | ||
| // Created by X-ray on 18/12/2025. | ||
| // | ||
|
|
||
| #include "cw2a.hpp" |
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,60 @@ | ||
| // | ||
| // Created by X-ray on 18/12/2025. | ||
| // | ||
|
|
||
| #pragma once | ||
|
|
||
| #include <windows.h> | ||
|
|
||
| namespace base::common::conversion { | ||
| class CW2A { | ||
| public: | ||
| explicit CW2A(const wchar_t* src, const UINT codePage = CP_ACP) | ||
| : m_buf(nullptr) { | ||
| if (!src) | ||
| return; | ||
|
|
||
| const int len = WideCharToMultiByte( | ||
| codePage, | ||
| 0, | ||
| src, | ||
| -1, | ||
| nullptr, | ||
| 0, | ||
| nullptr, | ||
| nullptr | ||
| ); | ||
|
|
||
| if (len <= 0) | ||
| return; | ||
|
|
||
| m_buf = new char[len]; | ||
|
|
||
| WideCharToMultiByte( | ||
| codePage, | ||
| 0, | ||
| src, | ||
| -1, | ||
| m_buf, | ||
| len, | ||
| nullptr, | ||
| nullptr | ||
| ); | ||
| } | ||
|
|
||
| ~CW2A() { | ||
| delete[] m_buf; | ||
| } | ||
|
|
||
| operator const char*() const { | ||
| return m_buf; | ||
| } | ||
|
|
||
| const char* c_str() const { | ||
| return m_buf; | ||
| } | ||
X-rays5 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| private: | ||
| char* m_buf; | ||
| }; | ||
X-rays5 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| } | ||
This file contains hidden or 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 hidden or 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 hidden or 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 |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| cmake_minimum_required(VERSION 3.26) | ||
| project(injector_test LANGUAGES CXX) | ||
|
|
||
| set(CMAKE_CXX_STANDARD 23) | ||
|
|
||
| file(GLOB_RECURSE INJECTOR_CPP_FILES ${CMAKE_CURRENT_SOURCE_DIR}../src/*.cpp) | ||
| list(REMOVE_ITEM INJECTOR_CPP_FILES | ||
| ${CMAKE_CURRENT_SOURCE_DIR}/src/main.cpp | ||
| ) | ||
|
|
||
| file(GLOB_RECURSE INJECTOR_HEADER_FILES ${CMAKE_CURRENT_SOURCE_DIR}../src/*.hpp) | ||
X-rays5 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
X-rays5 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
X-rays5 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| add_executable(${PROJECT_NAME} | ||
| ${INJECTOR_CPP_FILES} | ||
| ${INJECTOR_HEADER_FILES} | ||
| src/main.cpp | ||
| ) | ||
|
|
||
| include(../../vendor/gtest.cmake) | ||
| enable_testing() | ||
|
|
||
| include(GoogleTest) | ||
| gtest_discover_tests(${PROJECT_NAME}) | ||
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| // | ||
| // Created by X-ray on 18/12/2025. | ||
| // | ||
|
|
||
| #include <gtest/gtest.h> | ||
|
|
||
| int main(int argc, char** argv) { | ||
| ::testing::InitGoogleTest(&argc, argv); | ||
| return RUN_ALL_TESTS(); | ||
| } |
This file contains hidden or 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 hidden or 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 |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| cmake_minimum_required(VERSION 3.26) | ||
| project(menu_test LANGUAGES CXX) | ||
|
|
||
| set(CMAKE_CXX_STANDARD 23) | ||
|
|
||
| file(GLOB_RECURSE MENU_CPP_FILES ${CMAKE_CURRENT_SOURCE_DIR}../src/*.cpp) | ||
| list(REMOVE_ITEM MENU_CPP_FILES | ||
| ${CMAKE_CURRENT_SOURCE_DIR}/src/dllmain.cpp | ||
| ) | ||
|
|
||
| file(GLOB_RECURSE MENU_HEADER_FILES ${CMAKE_CURRENT_SOURCE_DIR}../src/*.hpp) | ||
X-rays5 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
X-rays5 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
X-rays5 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| add_executable(${PROJECT_NAME} | ||
| ${MENU_CPP_FILES} | ||
| ${MENU_HEADER_FILES} | ||
| src/main.cpp | ||
| ) | ||
|
|
||
| include(../../vendor/gtest.cmake) | ||
| enable_testing() | ||
|
|
||
| include(GoogleTest) | ||
| gtest_discover_tests(${PROJECT_NAME}) | ||
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| // | ||
| // Created by X-ray on 18/12/2025. | ||
| // | ||
|
|
||
| #include <gtest/gtest.h> | ||
|
|
||
| int main(int argc, char** argv) { | ||
| ::testing::InitGoogleTest(&argc, argv); | ||
| return RUN_ALL_TESTS(); | ||
| } |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.