#include "gtest/gtest.h"

#include "PrologInterface.h"
#include <iostream>

namespace {

static int glob_argc;
static char **glob_argv;

class PrologLifetimeTest : public ::testing::Test {
};

TEST_F(PrologLifetimeTest, BeginInitializesProlog) {
  PrologLifetime::begin(glob_argc, glob_argv);
  ASSERT_TRUE(PL_is_initialised(&glob_argc, &glob_argv));
  PrologLifetime::end();
}

}

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


#include "gtest/gtest.h"

#include "PrologInterface.h"
#include <iostream>

namespace {

static int glob_argc;
static char **glob_argv;

class PrologLifetimeTest : public ::testing::Test {
};

TEST_F(PrologLifetimeTest, BeginInitializesProlog) {
  PrologLifetime::begin(glob_argc, glob_argv);
  ASSERT_TRUE(PL_is_initialised(&glob_argc, &glob_argv));
  PrologLifetime::end();
}

TEST_F(PrologLifetimeTest, MultipleInitialization) {
  PrologLifetime::begin(glob_argc, glob_argv);
  ASSERT_TRUE(PL_is_initialised(&glob_argc, &glob_argv));
  PrologLifetime::end();

  ASSERT_FALSE(PL_is_initialised(&glob_argc, &glob_argv));

  PrologLifetime::begin(glob_argc, glob_argv);
  ASSERT_TRUE(PL_is_initialised(&glob_argc, &glob_argv));
  PrologLifetime::end();
}

}

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


Test multiple initialization for SWI-Prolog
Test multiple initialization for SWI-Prolog
