mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-11-29 20:58:27 +00:00
Merge branch 'main' into movingPlatformWork
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
#include "Amf3.h"
|
||||
|
||||
#include "Game.h"
|
||||
#include "dLogger.h"
|
||||
#include "Logger.h"
|
||||
|
||||
/**
|
||||
* Helper method that all tests use to get their respective AMF.
|
||||
|
||||
@@ -71,25 +71,15 @@ TEST(dCommonTests, AMF3InsertionAssociativeTest) {
|
||||
array.Insert<std::vector<uint32_t>>("Undefined", {});
|
||||
array.Insert("Null", nullptr);
|
||||
|
||||
std::cout << "test" << std::endl;
|
||||
ASSERT_EQ(array.Get<const char*>("CString")->GetValueType(), eAmf::String);
|
||||
std::cout << "test" << std::endl;
|
||||
ASSERT_EQ(array.Get<std::string>("String")->GetValueType(), eAmf::String);
|
||||
std::cout << "test" << std::endl;
|
||||
ASSERT_EQ(array.Get<bool>("False")->GetValueType(), eAmf::False);
|
||||
std::cout << "test" << std::endl;
|
||||
ASSERT_EQ(array.Get<bool>("True")->GetValueType(), eAmf::True);
|
||||
std::cout << "test" << std::endl;
|
||||
ASSERT_EQ(array.Get<int32_t>("Integer")->GetValueType(), eAmf::Integer);
|
||||
std::cout << "test" << std::endl;
|
||||
ASSERT_EQ(array.Get<double>("Double")->GetValueType(), eAmf::Double);
|
||||
std::cout << "test" << std::endl;
|
||||
ASSERT_EQ(array.GetArray("Array")->GetValueType(), eAmf::Array);
|
||||
std::cout << "test" << std::endl;
|
||||
ASSERT_EQ(array.Get<nullptr_t>("Null")->GetValueType(), eAmf::Null);
|
||||
std::cout << "test" << std::endl;
|
||||
ASSERT_EQ(array.Get<std::vector<uint32_t>>("Undefined")->GetValueType(), eAmf::Undefined);
|
||||
std::cout << "test" << std::endl;
|
||||
}
|
||||
|
||||
TEST(dCommonTests, AMF3InsertionDenseTest) {
|
||||
|
||||
@@ -1,13 +1,20 @@
|
||||
set(DCOMMONTEST_SOURCES
|
||||
"AMFDeserializeTests.cpp"
|
||||
"Amf3Tests.cpp"
|
||||
"CastUnderlyingTypeTests.cpp"
|
||||
"HeaderSkipTest.cpp"
|
||||
"TestCDFeatureGatingTable.cpp"
|
||||
"TestLDFFormat.cpp"
|
||||
"TestNiPoint3.cpp"
|
||||
"TestEncoding.cpp"
|
||||
"TestLUString.cpp"
|
||||
"TestLUWString.cpp"
|
||||
"dCommonDependencies.cpp"
|
||||
)
|
||||
|
||||
add_subdirectory(dEnumsTests)
|
||||
list(APPEND DCOMMONTEST_SOURCES ${DENUMS_TESTS})
|
||||
|
||||
# Set our executable
|
||||
add_executable(dCommonTests ${DCOMMONTEST_SOURCES})
|
||||
|
||||
|
||||
24
tests/dCommonTests/CastUnderlyingTypeTests.cpp
Normal file
24
tests/dCommonTests/CastUnderlyingTypeTests.cpp
Normal file
@@ -0,0 +1,24 @@
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include "GeneralUtils.h"
|
||||
|
||||
#include "eGameMasterLevel.h"
|
||||
#include "eGameMessageType.h"
|
||||
#include "eWorldMessageType.h"
|
||||
|
||||
#define ASSERT_TYPE_EQ(TYPE, ENUM)\
|
||||
ASSERT_TRUE(typeid(TYPE) == typeid(GeneralUtils::CastUnderlyingType(static_cast<ENUM>(0))));
|
||||
|
||||
#define ASSERT_TYPE_NE(TYPE, ENUM)\
|
||||
ASSERT_FALSE(typeid(TYPE) == typeid(GeneralUtils::CastUnderlyingType(static_cast<ENUM>(0))));
|
||||
|
||||
// Verify that the underlying enum types are being cast correctly
|
||||
TEST(CastUnderlyingTypeTests, VerifyCastUnderlyingType) {
|
||||
ASSERT_TYPE_EQ(uint8_t, eGameMasterLevel);
|
||||
ASSERT_TYPE_EQ(uint16_t, eGameMessageType);
|
||||
ASSERT_TYPE_EQ(uint32_t, eWorldMessageType)
|
||||
|
||||
ASSERT_TYPE_NE(void, eGameMasterLevel);
|
||||
ASSERT_TYPE_NE(void, eGameMessageType);
|
||||
ASSERT_TYPE_NE(void, eWorldMessageType)
|
||||
}
|
||||
55
tests/dCommonTests/TestCDFeatureGatingTable.cpp
Normal file
55
tests/dCommonTests/TestCDFeatureGatingTable.cpp
Normal file
@@ -0,0 +1,55 @@
|
||||
#include <gtest/gtest.h>
|
||||
#include "CDFeatureGatingTable.h"
|
||||
|
||||
|
||||
TEST(dCommonTests, CDFeaturingGatingComparison){
|
||||
CDFeatureGating a;
|
||||
a.major = 1;
|
||||
a.current = 10;
|
||||
a.minor = 64;
|
||||
|
||||
CDFeatureGating b;
|
||||
b.major = 999;
|
||||
b.current = 999;
|
||||
b.minor = 999;
|
||||
EXPECT_TRUE(b >= a);
|
||||
EXPECT_FALSE(a >= b);
|
||||
|
||||
// below
|
||||
b.major = 0;
|
||||
b.current = 10;
|
||||
b.minor = 64;
|
||||
EXPECT_FALSE(b >= a);
|
||||
EXPECT_TRUE(a >= b);
|
||||
|
||||
b.major = 1;
|
||||
b.current = 9;
|
||||
b.minor = 64;
|
||||
EXPECT_FALSE(b >= a);
|
||||
EXPECT_TRUE(a >= b);
|
||||
|
||||
b.major = 1;
|
||||
b.current = 10;
|
||||
b.minor = 63;
|
||||
EXPECT_FALSE(b >= a);
|
||||
EXPECT_TRUE(a >= b);
|
||||
|
||||
// above
|
||||
b.major = 2;
|
||||
b.current = 10;
|
||||
b.minor = 64;
|
||||
EXPECT_TRUE(b >= a);
|
||||
EXPECT_FALSE(a >= b);
|
||||
|
||||
b.major = 1;
|
||||
b.current = 11;
|
||||
b.minor = 64;
|
||||
EXPECT_TRUE(b >= a);
|
||||
EXPECT_FALSE(a >= b);
|
||||
|
||||
b.major = 1;
|
||||
b.current = 10;
|
||||
b.minor = 65;
|
||||
EXPECT_TRUE(b >= a);
|
||||
EXPECT_FALSE(a >= b);
|
||||
}
|
||||
@@ -26,7 +26,7 @@ TEST_F(EncodingTest, TestEncodingHello) {
|
||||
};
|
||||
|
||||
TEST_F(EncodingTest, TestEncodingUmlaut) {
|
||||
originalWord = u8"Frühling";
|
||||
originalWord = reinterpret_cast<const char*>(u8"Frühling");
|
||||
originalWordSv = originalWord;
|
||||
|
||||
GeneralUtils::_NextUTF8Char(originalWordSv, out); EXPECT_EQ(out, U'F');
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
#include "Game.h"
|
||||
#include "dCommonDependencies.h"
|
||||
#include "dLogger.h"
|
||||
#include "Logger.h"
|
||||
|
||||
class LDFTests : public dCommonDependenciesTest {
|
||||
protected:
|
||||
@@ -17,7 +17,7 @@ protected:
|
||||
}
|
||||
};
|
||||
|
||||
#define LdfUniquePtr std::unique_ptr<LDFBaseData>
|
||||
typedef std::unique_ptr<LDFBaseData> LdfUniquePtr;
|
||||
|
||||
// Suite of tests for parsing LDF values
|
||||
|
||||
@@ -237,7 +237,7 @@ TEST_F(LDFTests, LDFParseEdgeCaseTest) {
|
||||
"key=Garbage:value", // invalid LDF type
|
||||
};
|
||||
for (auto testString : tests) {
|
||||
Game::logger->Log("LDFTests", "Testing LDF Parsing of invalid string (%s)", testString.c_str());
|
||||
LOG("Testing LDF Parsing of invalid string (%s)", testString.c_str());
|
||||
EXPECT_NO_THROW(LDFBaseData::DataFromString(testString));
|
||||
}
|
||||
}
|
||||
|
||||
121
tests/dCommonTests/TestLUString.cpp
Normal file
121
tests/dCommonTests/TestLUString.cpp
Normal file
@@ -0,0 +1,121 @@
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include "dCommonVars.h"
|
||||
|
||||
TEST(LUString33Test, SerializeWriteTestOld) {
|
||||
CBITSTREAM;
|
||||
std::string testString;
|
||||
for (int i = 0; i < 33; i++) testString += "a";
|
||||
for (const auto& c : testString) bitStream.Write(c);
|
||||
std::string result;
|
||||
char c;
|
||||
while (bitStream.Read(c)) result += c;
|
||||
ASSERT_EQ(result, testString);
|
||||
}
|
||||
|
||||
TEST(LUString33Test, SerializeWriteTestOldPartial) {
|
||||
CBITSTREAM;
|
||||
std::string testString;
|
||||
for (int i = 0; i < 15; i++) testString += "a";
|
||||
for (const auto& c : testString) bitStream.Write(c);
|
||||
for (int i = 0; i < 18; i++) bitStream.Write<char>(0);
|
||||
std::string result;
|
||||
char c;
|
||||
int nulls = 18;
|
||||
while (bitStream.Read(c)){
|
||||
if (c == 0) {
|
||||
nulls--;
|
||||
continue;
|
||||
}
|
||||
result += c;
|
||||
}
|
||||
ASSERT_EQ(nulls, 0);
|
||||
ASSERT_EQ(result, testString);
|
||||
}
|
||||
|
||||
TEST(LUString33Test, SerializeWriteTestNew) {
|
||||
CBITSTREAM;
|
||||
std::string testString;
|
||||
for (int i = 0; i < 33; i++) testString += "a";
|
||||
bitStream.Write(LUString(testString, 33));
|
||||
std::string result;
|
||||
char c;
|
||||
while (bitStream.Read(c)) result += c;
|
||||
ASSERT_EQ(result, testString);
|
||||
}
|
||||
|
||||
TEST(LUString33Test, SerializeWriteTestNewPartial) {
|
||||
CBITSTREAM;
|
||||
std::string testString;
|
||||
for (int i = 0; i < 15; i++) testString += "a";
|
||||
bitStream.Write(LUString(testString, 33));
|
||||
std::string result;
|
||||
char c;
|
||||
int nulls = 18;
|
||||
while (bitStream.Read(c)){
|
||||
if (c == 0) {
|
||||
nulls--;
|
||||
continue;
|
||||
}
|
||||
result += c;
|
||||
}
|
||||
ASSERT_EQ(nulls, 0);
|
||||
ASSERT_EQ(result, testString);
|
||||
}
|
||||
|
||||
TEST(LUString33Test, SerializeReadTestOld) {
|
||||
CBITSTREAM;
|
||||
std::string testString;
|
||||
for (int i = 0; i < 33; i++) testString += "a";
|
||||
for (const auto& c : testString) bitStream.Write(c);
|
||||
std::string result;
|
||||
char c;
|
||||
while (bitStream.Read(c)) result += c;
|
||||
ASSERT_EQ(bitStream.GetNumberOfUnreadBits(), 0);
|
||||
ASSERT_EQ(result, testString);
|
||||
}
|
||||
|
||||
TEST(LUString33Test, SerializeReadTestOldPartial) {
|
||||
CBITSTREAM;
|
||||
std::string testString;
|
||||
for (int i = 0; i < 15; i++) testString += "a";
|
||||
for (const auto& c : testString) bitStream.Write(c);
|
||||
for (int i = 0; i < 18; i++) bitStream.Write<char>(0);
|
||||
std::string result;
|
||||
char c;
|
||||
int nulls = 18;
|
||||
while (bitStream.Read(c)){
|
||||
if (c == 0) {
|
||||
nulls--;
|
||||
continue;
|
||||
}
|
||||
result += c;
|
||||
}
|
||||
ASSERT_EQ(bitStream.GetNumberOfUnreadBits(), 0);
|
||||
ASSERT_EQ(nulls, 0);
|
||||
ASSERT_EQ(result, testString);
|
||||
}
|
||||
|
||||
TEST(LUString33Test, SerializeReadTestNew) {
|
||||
CBITSTREAM;
|
||||
std::string testString;
|
||||
for (int i = 0; i < 33; i++) testString += "a";
|
||||
bitStream.Write(LUString(testString, 33));
|
||||
LUString result;
|
||||
ASSERT_EQ(result.size, 33);
|
||||
ASSERT_TRUE(bitStream.Read(result));
|
||||
ASSERT_EQ(bitStream.GetNumberOfUnreadBits(), 0);
|
||||
ASSERT_EQ(result.string, testString);
|
||||
}
|
||||
|
||||
TEST(LUString33Test, SerializeReadTestNewPartial) {
|
||||
CBITSTREAM;
|
||||
std::string testString;
|
||||
for (int i = 0; i < 15; i++) testString += "a";
|
||||
bitStream.Write(LUString(testString, 33));
|
||||
LUString result;
|
||||
ASSERT_EQ(result.size, 33);
|
||||
ASSERT_TRUE(bitStream.Read(result));
|
||||
ASSERT_EQ(bitStream.GetNumberOfUnreadBits(), 0);
|
||||
ASSERT_EQ(result.string, testString);
|
||||
}
|
||||
121
tests/dCommonTests/TestLUWString.cpp
Normal file
121
tests/dCommonTests/TestLUWString.cpp
Normal file
@@ -0,0 +1,121 @@
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include "dCommonVars.h"
|
||||
|
||||
TEST(LUWString33Test, SerializeWriteTestOld) {
|
||||
CBITSTREAM;
|
||||
std::u16string testString;
|
||||
for (int i = 0; i < 33; i++) testString += u'ü';
|
||||
for (const auto& c : testString) bitStream.Write(c);
|
||||
std::u16string result;
|
||||
char16_t c;
|
||||
while (bitStream.Read(c)) result += c;
|
||||
ASSERT_EQ(result, testString);
|
||||
}
|
||||
|
||||
TEST(LUWString33Test, SerializeWriteTestOldPartial) {
|
||||
CBITSTREAM;
|
||||
std::u16string testString;
|
||||
for (int i = 0; i < 15; i++) testString += u'ü';
|
||||
for (const auto& c : testString) bitStream.Write(c);
|
||||
for (int i = 0; i < 18; i++) bitStream.Write<char16_t>(0);
|
||||
std::u16string result;
|
||||
char16_t c;
|
||||
int nulls = 18;
|
||||
while (bitStream.Read(c)){
|
||||
if (c == 0) {
|
||||
nulls--;
|
||||
continue;
|
||||
}
|
||||
result += c;
|
||||
}
|
||||
ASSERT_EQ(nulls, 0);
|
||||
ASSERT_EQ(result, testString);
|
||||
}
|
||||
|
||||
TEST(LUWString33Test, SerializeWriteTestNew) {
|
||||
CBITSTREAM;
|
||||
std::u16string testString;
|
||||
for (int i = 0; i < 33; i++) testString += u'ü';
|
||||
bitStream.Write(LUWString(testString, 33));
|
||||
std::u16string result;
|
||||
char16_t c;
|
||||
while (bitStream.Read(c)) result += c;
|
||||
ASSERT_EQ(result, testString);
|
||||
}
|
||||
|
||||
TEST(LUWString33Test, SerializeWriteTestNewPartial) {
|
||||
CBITSTREAM;
|
||||
std::u16string testString;
|
||||
for (int i = 0; i < 15; i++) testString += u'ü';
|
||||
bitStream.Write(LUWString(testString, 33));
|
||||
std::u16string result;
|
||||
char16_t c;
|
||||
int nulls = 18;
|
||||
while (bitStream.Read(c)){
|
||||
if (c == 0) {
|
||||
nulls--;
|
||||
continue;
|
||||
}
|
||||
result += c;
|
||||
}
|
||||
ASSERT_EQ(nulls, 0);
|
||||
ASSERT_EQ(result, testString);
|
||||
}
|
||||
|
||||
TEST(LUWString33Test, SerializeReadTestOld) {
|
||||
CBITSTREAM;
|
||||
std::u16string testString;
|
||||
for (int i = 0; i < 33; i++) testString += u'ü';
|
||||
for (const auto& c : testString) bitStream.Write(c);
|
||||
std::u16string result;
|
||||
char16_t c;
|
||||
while (bitStream.Read(c)) result += c;
|
||||
ASSERT_EQ(bitStream.GetNumberOfUnreadBits(), 0);
|
||||
ASSERT_EQ(result, testString);
|
||||
}
|
||||
|
||||
TEST(LUWString33Test, SerializeReadTestOldPartial) {
|
||||
CBITSTREAM;
|
||||
std::u16string testString;
|
||||
for (int i = 0; i < 15; i++) testString += u'ü';
|
||||
for (const auto& c : testString) bitStream.Write(c);
|
||||
for (int i = 0; i < 18; i++) bitStream.Write<char16_t>(0);
|
||||
std::u16string result;
|
||||
char16_t c;
|
||||
int nulls = 18;
|
||||
while (bitStream.Read(c)){
|
||||
if (c == 0) {
|
||||
nulls--;
|
||||
continue;
|
||||
}
|
||||
result += c;
|
||||
}
|
||||
ASSERT_EQ(bitStream.GetNumberOfUnreadBits(), 0);
|
||||
ASSERT_EQ(nulls, 0);
|
||||
ASSERT_EQ(result, testString);
|
||||
}
|
||||
|
||||
TEST(LUWString33Test, SerializeReadTestNew) {
|
||||
CBITSTREAM;
|
||||
std::u16string testString;
|
||||
for (int i = 0; i < 33; i++) testString += u'ü';
|
||||
bitStream.Write(LUWString(testString, 33));
|
||||
LUWString result;
|
||||
ASSERT_EQ(result.size, 33);
|
||||
ASSERT_TRUE(bitStream.Read(result));
|
||||
ASSERT_EQ(bitStream.GetNumberOfUnreadBits(), 0);
|
||||
ASSERT_EQ(result.string, testString);
|
||||
}
|
||||
|
||||
TEST(LUWString33Test, SerializeReadTestNewPartial) {
|
||||
CBITSTREAM;
|
||||
std::u16string testString;
|
||||
for (int i = 0; i < 15; i++) testString += u'ü';
|
||||
bitStream.Write(LUWString(testString, 33));
|
||||
LUWString result;
|
||||
ASSERT_EQ(result.size, 33);
|
||||
ASSERT_TRUE(bitStream.Read(result));
|
||||
ASSERT_EQ(bitStream.GetNumberOfUnreadBits(), 0);
|
||||
ASSERT_EQ(result.string, testString);
|
||||
}
|
||||
@@ -8,9 +8,9 @@
|
||||
*/
|
||||
TEST(dCommonTests, NiPoint3Test) {
|
||||
// Check that Unitize works
|
||||
ASSERT_EQ(NiPoint3(3, 0, 0).Unitize(), NiPoint3::UNIT_X);
|
||||
ASSERT_EQ(NiPoint3(3, 0, 0).Unitize(), NiPoint3Constant::UNIT_X);
|
||||
// Check what unitize does to a vector of length 0
|
||||
ASSERT_EQ(NiPoint3::ZERO.Unitize(), NiPoint3::ZERO);
|
||||
ASSERT_EQ(NiPoint3Constant::ZERO.Unitize(), NiPoint3Constant::ZERO);
|
||||
}
|
||||
|
||||
TEST(dCommonTests, NiPoint3OperatorTest) {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#include "Game.h"
|
||||
|
||||
class dLogger;
|
||||
class Logger;
|
||||
namespace Game
|
||||
{
|
||||
dLogger* logger;
|
||||
Logger* logger;
|
||||
} // namespace Game
|
||||
|
||||
@@ -2,17 +2,15 @@
|
||||
#define __DCOMMONDEPENDENCIES__H__
|
||||
|
||||
#include "Game.h"
|
||||
#include "dLogger.h"
|
||||
#include "Logger.h"
|
||||
#include "dServer.h"
|
||||
#include "EntityInfo.h"
|
||||
#include "EntityManager.h"
|
||||
#include "dConfig.h"
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
class dCommonDependenciesTest : public ::testing::Test {
|
||||
protected:
|
||||
void SetUpDependencies() {
|
||||
Game::logger = new dLogger("./testing.log", true, true);
|
||||
Game::logger = new Logger("./testing.log", true, true);
|
||||
}
|
||||
|
||||
void TearDownDependencies() {
|
||||
|
||||
10
tests/dCommonTests/dEnumsTests/CMakeLists.txt
Normal file
10
tests/dCommonTests/dEnumsTests/CMakeLists.txt
Normal file
@@ -0,0 +1,10 @@
|
||||
set(DENUMS_TESTS
|
||||
"MagicEnumTests.cpp"
|
||||
)
|
||||
|
||||
# Get the folder name and prepend it to the files above
|
||||
get_filename_component(thisFolderName ${CMAKE_CURRENT_SOURCE_DIR} NAME)
|
||||
list(TRANSFORM DENUMS_TESTS PREPEND "${thisFolderName}/")
|
||||
|
||||
# Export to parent scope
|
||||
set(DENUMS_TESTS ${DENUMS_TESTS} PARENT_SCOPE)
|
||||
145
tests/dCommonTests/dEnumsTests/MagicEnumTests.cpp
Normal file
145
tests/dCommonTests/dEnumsTests/MagicEnumTests.cpp
Normal file
@@ -0,0 +1,145 @@
|
||||
#include <chrono>
|
||||
#include <string>
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include "StringifiedEnum.h"
|
||||
#include "Logger.h"
|
||||
#include "Game.h"
|
||||
#include "eGameMessageType.h"
|
||||
#include "eWorldMessageType.h"
|
||||
#include "magic_enum.hpp"
|
||||
|
||||
#define ENUM_EQ(e, y, z)\
|
||||
LOG("%s %s", StringifiedEnum::ToString(static_cast<e>(y)).data(), #z);\
|
||||
ASSERT_STREQ(StringifiedEnum::ToString(static_cast<e>(y)).data(), #z);
|
||||
|
||||
#define ENUM_NE(e, y)\
|
||||
ENUM_EQ(e, y, UNKNOWN);
|
||||
|
||||
// Test World Message Enum Reflection
|
||||
TEST(MagicEnumTest, eWorldMessageTypeTest) {
|
||||
Game::logger = new Logger("./MagicEnumTest_eWorldMessageTypeTest.log", true, true);
|
||||
|
||||
ENUM_EQ(eWorldMessageType, 1, VALIDATION);
|
||||
ENUM_EQ(eWorldMessageType, 2, CHARACTER_LIST_REQUEST);
|
||||
ENUM_EQ(eWorldMessageType, 3, CHARACTER_CREATE_REQUEST);
|
||||
ENUM_EQ(eWorldMessageType, 4, LOGIN_REQUEST);
|
||||
ENUM_EQ(eWorldMessageType, 5, GAME_MSG);
|
||||
ENUM_EQ(eWorldMessageType, 6, CHARACTER_DELETE_REQUEST);
|
||||
ENUM_EQ(eWorldMessageType, 7, CHARACTER_RENAME_REQUEST);
|
||||
ENUM_EQ(eWorldMessageType, 8, HAPPY_FLOWER_MODE_NOTIFY);
|
||||
ENUM_EQ(eWorldMessageType, 9, SLASH_RELOAD_MAP);
|
||||
ENUM_EQ(eWorldMessageType, 10, SLASH_PUSH_MAP_REQUEST);
|
||||
ENUM_EQ(eWorldMessageType, 11, SLASH_PUSH_MAP);
|
||||
ENUM_EQ(eWorldMessageType, 12, SLASH_PULL_MAP);
|
||||
ENUM_EQ(eWorldMessageType, 13, LOCK_MAP_REQUEST);
|
||||
ENUM_EQ(eWorldMessageType, 14, GENERAL_CHAT_MESSAGE);
|
||||
ENUM_EQ(eWorldMessageType, 15, HTTP_MONITOR_INFO_REQUEST);
|
||||
ENUM_EQ(eWorldMessageType, 16, SLASH_DEBUG_SCRIPTS);
|
||||
ENUM_EQ(eWorldMessageType, 17, MODELS_CLEAR);
|
||||
ENUM_EQ(eWorldMessageType, 18, EXHIBIT_INSERT_MODEL);
|
||||
ENUM_EQ(eWorldMessageType, 19, LEVEL_LOAD_COMPLETE);
|
||||
ENUM_EQ(eWorldMessageType, 20, TMP_GUILD_CREATE);
|
||||
ENUM_EQ(eWorldMessageType, 21, ROUTE_PACKET);
|
||||
ENUM_EQ(eWorldMessageType, 22, POSITION_UPDATE);
|
||||
ENUM_EQ(eWorldMessageType, 23, MAIL);
|
||||
ENUM_EQ(eWorldMessageType, 24, WORD_CHECK);
|
||||
ENUM_EQ(eWorldMessageType, 25, STRING_CHECK);
|
||||
ENUM_EQ(eWorldMessageType, 26, GET_PLAYERS_IN_ZONE);
|
||||
ENUM_EQ(eWorldMessageType, 27, REQUEST_UGC_MANIFEST_INFO);
|
||||
ENUM_EQ(eWorldMessageType, 28, BLUEPRINT_GET_ALL_DATA_REQUEST);
|
||||
ENUM_EQ(eWorldMessageType, 29, CANCEL_MAP_QUEUE);
|
||||
ENUM_EQ(eWorldMessageType, 30, HANDLE_FUNNESS);
|
||||
ENUM_EQ(eWorldMessageType, 31, FAKE_PRG_CSR_MESSAGE);
|
||||
ENUM_EQ(eWorldMessageType, 32, REQUEST_FREE_TRIAL_REFRESH);
|
||||
ENUM_EQ(eWorldMessageType, 33, GM_SET_FREE_TRIAL_STATUS);
|
||||
ENUM_EQ(eWorldMessageType, 91, UI_HELP_TOP_5);
|
||||
ENUM_NE(eWorldMessageType, 37);
|
||||
ENUM_NE(eWorldMessageType, 123);
|
||||
|
||||
srand(time(NULL));
|
||||
auto begin = std::chrono::high_resolution_clock::now();
|
||||
for (int i = 0; i < 10000000; ++i) {
|
||||
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);
|
||||
}
|
||||
auto end = std::chrono::high_resolution_clock::now();
|
||||
LOG("Time: %lld", std::chrono::duration_cast<std::chrono::microseconds>(end - begin).count());
|
||||
|
||||
delete Game::logger;
|
||||
}
|
||||
|
||||
// Test Game Message Enum Reflection
|
||||
TEST(MagicEnumTest, eGameMessageTypeTest) {
|
||||
|
||||
Game::logger = new Logger("./MagicEnumTest_eGameMessageTypeTest.log", true, true);
|
||||
|
||||
// Only doing the first and last 10 for the sake of my sanity
|
||||
ENUM_EQ(eGameMessageType, 0, GET_POSITION);
|
||||
ENUM_EQ(eGameMessageType, 1, GET_ROTATION);
|
||||
ENUM_EQ(eGameMessageType, 2, GET_LINEAR_VELOCITY);
|
||||
ENUM_EQ(eGameMessageType, 3, GET_ANGULAR_VELOCITY);
|
||||
ENUM_EQ(eGameMessageType, 4, GET_FORWARD_VELOCITY);
|
||||
ENUM_EQ(eGameMessageType, 5, GET_PLAYER_FORWARD);
|
||||
ENUM_EQ(eGameMessageType, 6, GET_FORWARD_VECTOR);
|
||||
ENUM_EQ(eGameMessageType, 7, SET_POSITION);
|
||||
ENUM_EQ(eGameMessageType, 8, SET_LOCAL_POSITION);
|
||||
ENUM_EQ(eGameMessageType, 9, SET_ROTATION);
|
||||
ENUM_EQ(eGameMessageType, 10, SET_LINEAR_VELOCITY);
|
||||
ENUM_EQ(eGameMessageType, 1762, USE_SKILL_SET);
|
||||
ENUM_EQ(eGameMessageType, 1763, SET_SKILL_SET_POSSESSOR);
|
||||
ENUM_EQ(eGameMessageType, 1764, POPULATE_ACTION_BAR);
|
||||
ENUM_EQ(eGameMessageType, 1765, GET_COMPONENT_TEMPLATE_ID);
|
||||
ENUM_EQ(eGameMessageType, 1766, GET_POSSESSABLE_SKILL_SET);
|
||||
ENUM_EQ(eGameMessageType, 1767, MARK_INVENTORY_ITEM_AS_ACTIVE);
|
||||
ENUM_EQ(eGameMessageType, 1768, UPDATE_FORGED_ITEM);
|
||||
ENUM_EQ(eGameMessageType, 1769, CAN_ITEMS_BE_REFORGED);
|
||||
ENUM_EQ(eGameMessageType, 1771, NOTIFY_CLIENT_RAIL_START_FAILED);
|
||||
ENUM_EQ(eGameMessageType, 1772, GET_IS_ON_RAIL);
|
||||
ENUM_NE(eGameMessageType, 32);
|
||||
ENUM_NE(eGameMessageType, 1776);
|
||||
|
||||
srand(time(NULL));
|
||||
auto begin = std::chrono::high_resolution_clock::now();
|
||||
for (int i = 0; i < 10000000; ++i) {
|
||||
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);
|
||||
}
|
||||
auto end = std::chrono::high_resolution_clock::now();
|
||||
LOG("Time: %lld", 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());
|
||||
|
||||
namespace {
|
||||
template <typename T>
|
||||
void AssertEnumArraySorted(const T& eArray) {
|
||||
for (int i = 0; i < eArray->size(); ++i) {
|
||||
const auto entryCurr = eArray->at(i).first;
|
||||
LOG_EARRAY(eArray, i, entryCurr);
|
||||
const auto entryNext = eArray->at(++i).first;
|
||||
LOG_EARRAY(eArray, i, entryNext);
|
||||
ASSERT_TRUE(entryCurr < entryNext);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Test that the magic enum arrays are pre-sorted
|
||||
TEST(MagicEnumTest, ArraysAreSorted) {
|
||||
Game::logger = new Logger("./MagicEnumTest_ArraysAreSorted.log", true, true);
|
||||
|
||||
constexpr auto wmArray = &magic_enum::enum_entries<eWorldMessageType>();
|
||||
AssertEnumArraySorted(wmArray);
|
||||
|
||||
constexpr auto gmArray = &magic_enum::enum_entries<eGameMessageType>();
|
||||
AssertEnumArraySorted(gmArray);
|
||||
|
||||
delete Game::logger;
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
#include "GameDependencies.h"
|
||||
|
||||
namespace Game {
|
||||
dLogger* logger = nullptr;
|
||||
Logger* logger = nullptr;
|
||||
dServer* server = nullptr;
|
||||
dZoneManager* zoneManager = nullptr;
|
||||
dChatFilter* chatFilter = nullptr;
|
||||
@@ -11,6 +11,7 @@ namespace Game {
|
||||
AssetManager* assetManager = nullptr;
|
||||
SystemAddress chatSysAddr;
|
||||
EntityManager* entityManager = nullptr;
|
||||
std::string projectVersion;
|
||||
}
|
||||
|
||||
void GameDependenciesTest::SetUpDependencies() {
|
||||
|
||||
@@ -2,8 +2,9 @@
|
||||
#define __GAMEDEPENDENCIES__H__
|
||||
|
||||
#include "Game.h"
|
||||
#include "dLogger.h"
|
||||
#include "Logger.h"
|
||||
#include "dServer.h"
|
||||
#include "CDClientManager.h"
|
||||
#include "EntityInfo.h"
|
||||
#include "EntityManager.h"
|
||||
#include "dZoneManager.h"
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
set(DCOMPONENTS_TESTS
|
||||
"DestroyableComponentTests.cpp"
|
||||
"MovingPlatformComponentTests.cpp"
|
||||
"PetComponentTests.cpp"
|
||||
"SimplePhysicsComponentTests.cpp"
|
||||
)
|
||||
|
||||
# Get the folder name and prepend it to the files above
|
||||
|
||||
@@ -16,8 +16,7 @@ protected:
|
||||
void SetUp() override {
|
||||
SetUpDependencies();
|
||||
baseEntity = new Entity(15, GameDependenciesTest::info);
|
||||
destroyableComponent = new DestroyableComponent(baseEntity);
|
||||
baseEntity->AddComponent(eReplicaComponentType::DESTROYABLE, destroyableComponent);
|
||||
destroyableComponent = baseEntity->AddComponent<DestroyableComponent>();
|
||||
// Initialize some values to be not default
|
||||
destroyableComponent->SetMaxHealth(12345.0f);
|
||||
destroyableComponent->SetHealth(23);
|
||||
@@ -37,11 +36,19 @@ protected:
|
||||
}
|
||||
};
|
||||
|
||||
TEST_F(DestroyableTest, PlacementNewAddComponentTest) {
|
||||
ASSERT_NE(destroyableComponent, nullptr);
|
||||
ASSERT_EQ(destroyableComponent->GetArmor(), 7);
|
||||
baseEntity->AddComponent<DestroyableComponent>();
|
||||
ASSERT_NE(baseEntity->GetComponent<DestroyableComponent>(), nullptr);
|
||||
ASSERT_EQ(destroyableComponent->GetArmor(), 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test Construction of a DestroyableComponent
|
||||
*/
|
||||
TEST_F(DestroyableTest, DestroyableComponentSerializeConstructionTest) {
|
||||
destroyableComponent->Serialize(&bitStream, true, flags);
|
||||
destroyableComponent->Serialize(&bitStream, true);
|
||||
// Assert that the full number of bits are present
|
||||
ASSERT_EQ(bitStream.GetNumberOfUnreadBits(), 748);
|
||||
{
|
||||
@@ -171,7 +178,7 @@ TEST_F(DestroyableTest, DestroyableComponentSerializeTest) {
|
||||
destroyableComponent->SetMaxHealth(1233.0f);
|
||||
|
||||
// Now we test a serialization for correctness.
|
||||
destroyableComponent->Serialize(&bitStream, false, flags);
|
||||
destroyableComponent->Serialize(&bitStream, false);
|
||||
ASSERT_EQ(bitStream.GetNumberOfUnreadBits(), 422);
|
||||
{
|
||||
// Now read in the full serialized BitStream
|
||||
@@ -318,9 +325,7 @@ TEST_F(DestroyableTest, DestroyableComponentFactionTest) {
|
||||
|
||||
TEST_F(DestroyableTest, DestroyableComponentValiditiyTest) {
|
||||
auto* enemyEntity = new Entity(19, info);
|
||||
auto* enemyDestroyableComponent = new DestroyableComponent(enemyEntity);
|
||||
enemyEntity->AddComponent(eReplicaComponentType::DESTROYABLE, enemyDestroyableComponent);
|
||||
enemyDestroyableComponent->AddFactionNoLookup(16);
|
||||
enemyEntity->AddComponent<DestroyableComponent>()->AddFactionNoLookup(16);
|
||||
destroyableComponent->AddEnemyFaction(16);
|
||||
EXPECT_TRUE(destroyableComponent->IsEnemy(enemyEntity));
|
||||
EXPECT_FALSE(destroyableComponent->IsFriend(enemyEntity));
|
||||
@@ -531,3 +536,22 @@ TEST_F(DestroyableTest, DestroyableComponentImmunityTest) {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Test the Damage cooldown timer of DestroyableComponent
|
||||
*/
|
||||
TEST_F(DestroyableTest, DestroyableComponentDamageCooldownTest) {
|
||||
// Test the damage immune timer state (anything above 0.0f)
|
||||
destroyableComponent->SetDamageCooldownTimer(1.0f);
|
||||
EXPECT_FLOAT_EQ(destroyableComponent->GetDamageCooldownTimer(), 1.0f);
|
||||
ASSERT_TRUE(destroyableComponent->IsCooldownImmune());
|
||||
|
||||
// Test that the Update() function correctly decrements the damage cooldown timer
|
||||
destroyableComponent->Update(0.5f);
|
||||
EXPECT_FLOAT_EQ(destroyableComponent->GetDamageCooldownTimer(), 0.5f);
|
||||
ASSERT_TRUE(destroyableComponent->IsCooldownImmune());
|
||||
|
||||
// Test the non damage immune timer state (anything below or equal to 0.0f)
|
||||
destroyableComponent->SetDamageCooldownTimer(0.0f);
|
||||
EXPECT_FLOAT_EQ(destroyableComponent->GetDamageCooldownTimer(), 0.0f);
|
||||
ASSERT_FALSE(destroyableComponent->IsCooldownImmune());
|
||||
}
|
||||
|
||||
43
tests/dGameTests/dComponentsTests/PetComponentTests.cpp
Normal file
43
tests/dGameTests/dComponentsTests/PetComponentTests.cpp
Normal file
@@ -0,0 +1,43 @@
|
||||
#include "GameDependencies.h"
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include "BitStream.h"
|
||||
#include "PetComponent.h"
|
||||
#include "Entity.h"
|
||||
#include "eReplicaComponentType.h"
|
||||
#include "ePetAbilityType.h"
|
||||
#include "eStateChangeType.h"
|
||||
|
||||
class PetTest : public GameDependenciesTest {
|
||||
protected:
|
||||
Entity* baseEntity;
|
||||
PetComponent* petComponent;
|
||||
CBITSTREAM
|
||||
|
||||
void SetUp() override {
|
||||
SetUpDependencies();
|
||||
|
||||
// Set up entity and pet component
|
||||
baseEntity = new Entity(15, GameDependenciesTest::info);
|
||||
petComponent = baseEntity->AddComponent<PetComponent>(1);
|
||||
|
||||
// Initialize some values to be not default
|
||||
|
||||
}
|
||||
|
||||
void TearDown() override {
|
||||
delete baseEntity;
|
||||
TearDownDependencies();
|
||||
}
|
||||
};
|
||||
|
||||
TEST_F(PetTest, PlacementNewAddComponentTest) {
|
||||
// Test adding component
|
||||
ASSERT_NE(petComponent, nullptr);
|
||||
baseEntity->AddComponent<PetComponent>(1);
|
||||
ASSERT_NE(baseEntity->GetComponent<PetComponent>(), nullptr);
|
||||
|
||||
// Test getting initial status
|
||||
ASSERT_EQ(petComponent->GetParent()->GetObjectID(), 15);
|
||||
ASSERT_EQ(petComponent->GetAbility(), ePetAbilityType::Invalid);
|
||||
}
|
||||
@@ -0,0 +1,153 @@
|
||||
#include "GameDependencies.h"
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
#include "BitStream.h"
|
||||
#include "SimplePhysicsComponent.h"
|
||||
#include "Entity.h"
|
||||
#include "eReplicaComponentType.h"
|
||||
#include "eStateChangeType.h"
|
||||
|
||||
class SimplePhysicsTest : public GameDependenciesTest {
|
||||
protected:
|
||||
std::unique_ptr<Entity> baseEntity;
|
||||
SimplePhysicsComponent* simplePhysicsComponent;
|
||||
CBITSTREAM;
|
||||
void SetUp() override {
|
||||
SetUpDependencies();
|
||||
baseEntity = std::make_unique<Entity>(15, GameDependenciesTest::info);
|
||||
simplePhysicsComponent = baseEntity->AddComponent<SimplePhysicsComponent>(1);
|
||||
simplePhysicsComponent->SetClimbableType(eClimbableType::CLIMBABLE_TYPE_WALL);
|
||||
simplePhysicsComponent->SetPosition(NiPoint3(1.0f, 2.0f, 3.0f));
|
||||
simplePhysicsComponent->SetRotation(NiQuaternion(1.0f, 2.0f, 3.0f, 4.0f));
|
||||
simplePhysicsComponent->SetVelocity(NiPoint3(5.0f, 6.0f, 7.0f));
|
||||
simplePhysicsComponent->SetAngularVelocity(NiPoint3(5.0f, 6.0f, 7.0f));
|
||||
simplePhysicsComponent->SetPhysicsMotionState(2);
|
||||
}
|
||||
|
||||
void TearDown() override {
|
||||
TearDownDependencies();
|
||||
}
|
||||
};
|
||||
|
||||
TEST_F(SimplePhysicsTest, SimplePhysicsSerializeTest) {
|
||||
simplePhysicsComponent->Serialize(&bitStream, false);
|
||||
constexpr uint32_t sizeOfStream = 3 + BYTES_TO_BITS(3 * sizeof(NiPoint3)) + BYTES_TO_BITS(1 * sizeof(NiQuaternion)) + 1 * BYTES_TO_BITS(sizeof(uint32_t));
|
||||
ASSERT_EQ(bitStream.GetNumberOfBitsUsed(), sizeOfStream);
|
||||
|
||||
bool dirtyVelocityFlag;
|
||||
bitStream.Read(dirtyVelocityFlag);
|
||||
ASSERT_EQ(dirtyVelocityFlag, true);
|
||||
|
||||
NiPoint3 velocity;
|
||||
bitStream.Read(velocity.x);
|
||||
bitStream.Read(velocity.y);
|
||||
bitStream.Read(velocity.z);
|
||||
ASSERT_EQ(velocity, NiPoint3(5.0f, 6.0f, 7.0f));
|
||||
|
||||
NiPoint3 angularVelocity;
|
||||
bitStream.Read(angularVelocity.x);
|
||||
bitStream.Read(angularVelocity.y);
|
||||
bitStream.Read(angularVelocity.z);
|
||||
ASSERT_EQ(angularVelocity, NiPoint3(5.0f, 6.0f, 7.0f));
|
||||
|
||||
bool dirtyPhysicsMotionStateFlag;
|
||||
bitStream.Read(dirtyPhysicsMotionStateFlag);
|
||||
ASSERT_EQ(dirtyPhysicsMotionStateFlag, true);
|
||||
|
||||
uint32_t physicsMotionState;
|
||||
bitStream.Read(physicsMotionState);
|
||||
ASSERT_EQ(physicsMotionState, 2.0f);
|
||||
|
||||
bool dirtyPositionFlag;
|
||||
bitStream.Read(dirtyPositionFlag);
|
||||
ASSERT_EQ(dirtyPositionFlag, true);
|
||||
|
||||
NiPoint3 position;
|
||||
bitStream.Read(position.x);
|
||||
bitStream.Read(position.y);
|
||||
bitStream.Read(position.z);
|
||||
ASSERT_EQ(position, NiPoint3(1.0f, 2.0f, 3.0f));
|
||||
|
||||
NiQuaternion rotation;
|
||||
bitStream.Read(rotation.x);
|
||||
bitStream.Read(rotation.y);
|
||||
bitStream.Read(rotation.z);
|
||||
bitStream.Read(rotation.w);
|
||||
ASSERT_EQ(rotation, NiQuaternion(1.0f, 2.0f, 3.0f, 4.0f));
|
||||
}
|
||||
|
||||
TEST_F(SimplePhysicsTest, SimplePhysicsConstructionTest) {
|
||||
simplePhysicsComponent->Serialize(&bitStream, true);
|
||||
constexpr uint32_t sizeOfStream = 4 + BYTES_TO_BITS(1 * sizeof(int32_t)) + BYTES_TO_BITS(3 * sizeof(NiPoint3)) + BYTES_TO_BITS(1 * sizeof(NiQuaternion)) + 1 * BYTES_TO_BITS(sizeof(uint32_t));
|
||||
ASSERT_EQ(bitStream.GetNumberOfBitsUsed(), sizeOfStream);
|
||||
|
||||
bool dirtyClimbableTypeFlag;
|
||||
bitStream.Read(dirtyClimbableTypeFlag);
|
||||
ASSERT_EQ(dirtyClimbableTypeFlag, true);
|
||||
|
||||
int32_t climbableType;
|
||||
bitStream.Read(climbableType);
|
||||
ASSERT_EQ(climbableType, 2);
|
||||
|
||||
bool dirtyVelocityFlag;
|
||||
bitStream.Read(dirtyVelocityFlag);
|
||||
ASSERT_EQ(dirtyVelocityFlag, true);
|
||||
|
||||
NiPoint3 velocity;
|
||||
bitStream.Read(velocity.x);
|
||||
bitStream.Read(velocity.y);
|
||||
bitStream.Read(velocity.z);
|
||||
ASSERT_EQ(velocity, NiPoint3(5.0f, 6.0f, 7.0f));
|
||||
|
||||
NiPoint3 angularVelocity;
|
||||
bitStream.Read(angularVelocity.x);
|
||||
bitStream.Read(angularVelocity.y);
|
||||
bitStream.Read(angularVelocity.z);
|
||||
ASSERT_EQ(angularVelocity, NiPoint3(5.0f, 6.0f, 7.0f));
|
||||
|
||||
bool dirtyPhysicsMotionStateFlag;
|
||||
bitStream.Read(dirtyPhysicsMotionStateFlag);
|
||||
ASSERT_EQ(dirtyPhysicsMotionStateFlag, true);
|
||||
|
||||
uint32_t physicsMotionState;
|
||||
bitStream.Read(physicsMotionState);
|
||||
ASSERT_EQ(physicsMotionState, 2.0f);
|
||||
|
||||
bool dirtyPositionFlag;
|
||||
bitStream.Read(dirtyPositionFlag);
|
||||
ASSERT_EQ(dirtyPositionFlag, true);
|
||||
|
||||
NiPoint3 position;
|
||||
bitStream.Read(position.x);
|
||||
bitStream.Read(position.y);
|
||||
bitStream.Read(position.z);
|
||||
ASSERT_EQ(position, NiPoint3(1.0f, 2.0f, 3.0f));
|
||||
|
||||
NiQuaternion rotation;
|
||||
bitStream.Read(rotation.x);
|
||||
bitStream.Read(rotation.y);
|
||||
bitStream.Read(rotation.z);
|
||||
bitStream.Read(rotation.w);
|
||||
ASSERT_EQ(rotation, NiQuaternion(1.0f, 2.0f, 3.0f, 4.0f));
|
||||
}
|
||||
|
||||
TEST_F(SimplePhysicsTest, SimplePhysicsGettersAndSettersTest) {
|
||||
ASSERT_EQ(simplePhysicsComponent->GetClimabbleType(), eClimbableType::CLIMBABLE_TYPE_WALL);
|
||||
ASSERT_EQ(simplePhysicsComponent->GetPosition(), NiPoint3(1.0f, 2.0f, 3.0f));
|
||||
ASSERT_EQ(simplePhysicsComponent->GetRotation(), NiQuaternion(1.0f, 2.0f, 3.0f, 4.0f));
|
||||
ASSERT_EQ(simplePhysicsComponent->GetVelocity(), NiPoint3(5.0f, 6.0f, 7.0f));
|
||||
ASSERT_EQ(simplePhysicsComponent->GetAngularVelocity(), NiPoint3(5.0f, 6.0f, 7.0f));
|
||||
ASSERT_EQ(simplePhysicsComponent->GetPhysicsMotionState(), 2);
|
||||
simplePhysicsComponent->SetClimbableType(eClimbableType::CLIMBABLE_TYPE_LADDER);
|
||||
simplePhysicsComponent->SetPosition(NiPoint3(4.0f, 5.0f, 6.0f));
|
||||
simplePhysicsComponent->SetRotation(NiQuaternion(4.0f, 5.0f, 6.0f, 7.0f));
|
||||
simplePhysicsComponent->SetVelocity(NiPoint3(6.0f, 7.0f, 8.0f));
|
||||
simplePhysicsComponent->SetAngularVelocity(NiPoint3(6.0f, 7.0f, 8.0f));
|
||||
simplePhysicsComponent->SetPhysicsMotionState(3);
|
||||
ASSERT_EQ(simplePhysicsComponent->GetClimabbleType(), eClimbableType::CLIMBABLE_TYPE_LADDER);
|
||||
ASSERT_EQ(simplePhysicsComponent->GetPosition(), NiPoint3(4.0f, 5.0f, 6.0f));
|
||||
ASSERT_EQ(simplePhysicsComponent->GetRotation(), NiQuaternion(4.0f, 5.0f, 6.0f, 7.0f));
|
||||
ASSERT_EQ(simplePhysicsComponent->GetVelocity(), NiPoint3(6.0f, 7.0f, 8.0f));
|
||||
ASSERT_EQ(simplePhysicsComponent->GetAngularVelocity(), NiPoint3(6.0f, 7.0f, 8.0f));
|
||||
ASSERT_EQ(simplePhysicsComponent->GetPhysicsMotionState(), 3);
|
||||
}
|
||||
Reference in New Issue
Block a user