#include <gmock/gmock.h>
#include <gtest/gtest.h>

#include <iostream>
#include "vector.hpp"
#include "point.hpp"
#include "share.hpp"
#include "triangle.hpp"
#include "mesh.hpp"

using namespace visual_engine::detail;
using namespace visual_engine;

int main(int argc, char **argv) {
  ::testing::InitGoogleTest(&argc, argv);
  return RUN_ALL_TESTS();
}

TEST(sainty_check, test1) { ASSERT_TRUE('b' == 'b'); }

TEST(sainty_check, test2) {
  linalg::vector a(1, 2, 3);
  ASSERT_TRUE(linalg::equal(a.normalized().length(), 1));
}

TEST(sainty_check, test3) {
  linalg::point  a(1, 2, 3);
  ASSERT_TRUE(a.is_valid());
}

TEST(sainty_check, test4) {
  linalg::vector v(1, 2, 3);
  ASSERT_TRUE(v.is_valid());
}

TEST(sainty_check, test5) {
  linalg::point a(1, 2, 3);
  linalg::point b(a);
  ASSERT_TRUE(a == b);
}

TEST(sainty_check, test6) {
  vector a(1, 0, 0);
  vector b(0, 0, 1);
  vector c(0, 0, -1);
  ASSERT_TRUE(a.product(b) == c.product(a));
}

TEST(sainty_check, test7) {
  vector a(1, 0, 0);
  vector b(0, 1, 0);
  vector c(0, 0, 1);
  ASSERT_TRUE(a.product(b) == c);
}

TEST(triag_behaviour, test0) {
  visual_engine::triangle A({1, 2, 3}, {1, 3, 4}, {2, 3, 4}, {1, 1, 1}),
                          B({0, 2, 3}, {1, 3, 0}, {2, 0, 4}, {0, 1, 1}),
                          C({5, 2, 3}, {1, 5, 4}, {5, 3, 4}, {1, 2, 1});
  std::vector<visual_engine::triangle> vec;
  vec.push_back(A), vec.push_back(B), vec.push_back(C);
  visual_engine::mesh msh(vec.begin(), vec.end(), 3);
  // msh.console_dump();
}