//#include <cstdio>

#include "Testing.h"

#include <Groom/Groom.h>
#include <Project/Project.h>

using namespace shapeworks;

//---------------------------------------------------------------------------
TEST(GroomTests, basic_test)
{
  std::string test_location = std::string(TEST_DATA_DIR) + std::string("/optimize/sphere");
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-result"
  chdir(test_location.c_str());
#pragma GCC diagnostic pop

  // make sure we clean out at least one necessary file to make sure we re-run
  std::remove("../shared/sphere/sphere10_DT.nrrd");

  ProjectHandle project = std::make_shared<Project>();
  project->load("groom.xlsx");
  Groom app(project);
  bool success = app.run();
  ASSERT_TRUE(success);

  Image image("groomed/sphere10_DT.nrrd");
  Image ground_truth("../shared/spheres/sphere10_DT_baseline.nrrd");

  ASSERT_TRUE(image == ground_truth);

}
