mirror of
				https://github.com/DarkflameUniverse/DarkflameServer.git
				synced 2025-10-30 20:22:04 +00:00 
			
		
		
		
	experimenting; not looking to pr
This commit is contained in:
		| @@ -32,7 +32,7 @@ add_custom_command(TARGET dCommonTests POST_BUILD | ||||
| endif() | ||||
|  | ||||
| # Link needed libraries | ||||
| target_link_libraries(dCommonTests ${COMMON_LIBRARIES} GTest::gtest_main) | ||||
| target_link_libraries(dCommonTests PRIVATE ${COMMON_LIBRARIES} GTest::gtest_main) | ||||
|  | ||||
| # Copy test files to testing directory | ||||
| add_subdirectory(TestBitStreams) | ||||
|   | ||||
| @@ -3,6 +3,7 @@ | ||||
|  | ||||
| #include <gtest/gtest.h> | ||||
|  | ||||
| #include "GeneralUtils.h" | ||||
| #include "StringifiedEnum.h" | ||||
| #include "Logger.h" | ||||
| #include "Game.h" | ||||
| @@ -11,7 +12,7 @@ | ||||
| #include "magic_enum.hpp" | ||||
|  | ||||
| #define ENUM_EQ(e, y, z)\ | ||||
| 	LOG("%s %s", StringifiedEnum::ToString(static_cast<e>(y)).data(), #z);\ | ||||
| 	Log::Info("{:s} {:s}", StringifiedEnum::ToString(static_cast<e>(y)), #z);\ | ||||
| 	ASSERT_STREQ(StringifiedEnum::ToString(static_cast<e>(y)).data(), #z); | ||||
|  | ||||
| #define ENUM_NE(e, y)\ | ||||
| @@ -64,10 +65,10 @@ TEST(MagicEnumTest, eWorldMessageTypeTest) { | ||||
| 		volatile auto f = StringifiedEnum::ToString(static_cast<eWorldMessageType>(i)).data(); | ||||
|  | ||||
| 		// To ensure the compiler doesn't optimize out the call, I print it at random intervals | ||||
| 		if (rand() % 100000 == 0) LOG("%i, %s", i, f); | ||||
| 		if (rand() % 100000 == 0) Log::Info("{:d}, {:s}", i, f); | ||||
| 	} | ||||
| 	auto end = std::chrono::high_resolution_clock::now(); | ||||
| 	LOG("Time: %lld", std::chrono::duration_cast<std::chrono::microseconds>(end - begin).count()); | ||||
| 	Log::Info("Time: {:d}", std::chrono::duration_cast<std::chrono::microseconds>(end - begin).count()); | ||||
|  | ||||
| 	delete Game::logger; | ||||
| } | ||||
| @@ -108,15 +109,15 @@ TEST(MagicEnumTest, eGameMessageTypeTest) { | ||||
| 		volatile auto f = StringifiedEnum::ToString(static_cast<eGameMessageType>(i)).data(); | ||||
|  | ||||
| 		// To ensure the compiler doesn't optimize out the call, I print it at random intervals | ||||
| 		if (rand() % 100000 == 0) LOG("%i, %s", i, f); | ||||
| 		if (rand() % 100000 == 0) Log::Info("{:d}, {:s}", i, f); | ||||
| 	} | ||||
| 	auto end = std::chrono::high_resolution_clock::now(); | ||||
| 	LOG("Time: %lld", std::chrono::duration_cast<std::chrono::microseconds>(end - begin).count()); | ||||
| 	Log::Info("Time: {:d}", std::chrono::duration_cast<std::chrono::microseconds>(end - begin).count()); | ||||
|  | ||||
| 	delete Game::logger; | ||||
| } | ||||
|  | ||||
| #define LOG_EARRAY(EARRAY_VAR, INDICE, ENTRY) LOG(#EARRAY_VAR"[%i] = %i, %s", INDICE, ENTRY, magic_enum::enum_name(ENTRY).data()); | ||||
| #define LOG_EARRAY(EARRAY_VAR, INDICE, ENTRY) Log::Info(#EARRAY_VAR"[{:d}] = {:d}, {:s}", INDICE, GeneralUtils::ToUnderlying(ENTRY), magic_enum::enum_name(ENTRY)); | ||||
|  | ||||
| namespace { | ||||
| 	template <typename T> | ||||
|   | ||||
| @@ -22,7 +22,7 @@ add_custom_command(TARGET dGameTests POST_BUILD | ||||
| 	WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}) | ||||
| endif() | ||||
|  | ||||
| target_link_libraries(dGameTests ${COMMON_LIBRARIES} GTest::gtest_main | ||||
| target_link_libraries(dGameTests PRIVATE ${COMMON_LIBRARIES} GTest::gtest_main | ||||
| 	dGame dScripts dPhysics Detour Recast tinyxml2 dWorldServer dZoneManager dChatFilter dNavigation) | ||||
|  | ||||
| # Discover the tests | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 jadebenn
					jadebenn