/*
 * Author:          Patrick-Christopher Mattulat
 * Company:         Lynar Studios
 * E-Mail:          webmaster@lynarstudios.com
 * Created:         2022-08-05
 * Changed:         2022-08-05
 *
 * */

#include <gtest/gtest.h>
#include <ls-math/ls_math_vector.hpp>

using namespace ls::math::vector;

namespace
{
  class Vector2Test : public ::testing::Test
  {
    protected:

      Vector2Test() = default;
      ~Vector2Test() override = default;

      void SetUp() override
      {}

      void TearDown() override
      {}
  };

  TEST_F(Vector2Test, operator_addition)
  {
    Vector2 c = Vector2(3, 4) + Vector2(5, 3);

    ASSERT_FLOAT_EQ(8, c.getX());
    ASSERT_FLOAT_EQ(7, c.getY());
  }

  TEST_F(Vector2Test, operator_substraction)
  {
    Vector2 c = Vector2(3, 4) - Vector2(5, 3);

    ASSERT_FLOAT_EQ(-2, c.getX());
    ASSERT_FLOAT_EQ(1, c.getY());
  }

  TEST_F(Vector2Test, getX)
  {
    Vector2 a{3, 4};
    ASSERT_FLOAT_EQ(3, a.getX());
  }

  TEST_F(Vector2Test, getY)
  {
    Vector2 a{3, 4};
    ASSERT_FLOAT_EQ(4, a.getY());
  }

  TEST_F(Vector2Test, setX)
  {
    Vector2 a{3, 4};
    a.setX(14);

    ASSERT_FLOAT_EQ(14, a.getX());
  }

  TEST_F(Vector2Test, setY)
  {
    Vector2 a{3, 4};
    a.setY(8);

    ASSERT_FLOAT_EQ(8, a.getY());
  }
}
