YoggieEngine/Tests/EngineTest.cpp

70 lines
1.7 KiB
C++
Raw Normal View History

#include <YoggieEngine.h>
#include <ImGuizmo.h>
#include <gtest/gtest.h>
TEST(HelloTDD, MyFirstTest) {
EXPECT_EQ(1, 1);
};
TEST(TRANSFORM_COMPONENT_TESTS , CAN_EXTRACT_TRANSLATION_FROM_TRANSFORM_MATRIX) {
auto component = YoggieEngine::TransformComponent{};
component.Position = glm::vec3(1.0f, 2.0f, 3.0f);
auto transformationMatrix = component.GetTransform();
auto newComponent = YoggieEngine::TransformComponent{};
newComponent.Decompose(transformationMatrix);
EXPECT_EQ(newComponent.Position.x, component.Position.x);
EXPECT_EQ(newComponent.Position.y, component.Position.y);
EXPECT_EQ(newComponent.Position.z, component.Position.z);
}
TEST(TRANSFORM_COMPONENT_TESTS, CAN_EXTRACT_SCALE_FROM_TRANSFORM_MATRIX) {
auto component = YoggieEngine::TransformComponent{};
component.Scale = glm::vec3(1.0f, 2.0f, 3.0f);
auto tranformationMatrix = component.GetTransform();
auto newComponent = YoggieEngine::TransformComponent{};
newComponent.Decompose(tranformationMatrix);
EXPECT_EQ(newComponent.Scale.x, component.Scale.x);
EXPECT_EQ(newComponent.Scale.y, component.Scale.y);
EXPECT_EQ(newComponent.Scale.z, component.Scale.z);
}
TEST(TRANSFORM_COMPONENT_TESTS, CAN_EXTRACT_ROTATION_FROM_TRANSFORM_MATRIX) {
auto component = YoggieEngine::TransformComponent{};
component.Rotation = glm::vec3(2.0f, 10.0f, 20.0f);
auto transformMatrix = component.GetTransform();
auto newComponent = YoggieEngine::TransformComponent{};
newComponent.Decompose(transformMatrix);
EXPECT_EQ(newComponent.Rotation.x, component.Rotation.x);
EXPECT_EQ(newComponent.Rotation.y, component.Rotation.y);
EXPECT_EQ(newComponent.Rotation.z, component.Rotation.z);
}
int main(int argc, char** argv) {
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}