Commit 6630bb97 authored by Mccaskey, Alex's avatar Mccaskey, Alex
Browse files

bug fix for tests when qcor installed separate from xacc

parent a5b14ddb
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -4,6 +4,6 @@
link_directories(${XACC_ROOT}/lib)
add_executable(PyXASMTokenCollectorTester PyXASMTokenCollectorTester.cpp)
add_test(NAME qcor_PyXASMTokenCollectorTester COMMAND PyXASMTokenCollectorTester)
target_include_directories(PyXASMTokenCollectorTester PRIVATE . ../../ ../../tests ${XACC_ROOT}/include/gtest)
target_include_directories(PyXASMTokenCollectorTester PRIVATE . ../../ ../../tests ${CMAKE_BINARY_DIR} ${XACC_ROOT}/include/gtest)
target_link_libraries(PyXASMTokenCollectorTester ${XACC_TEST_LIBRARIES} xacc::xacc test_utils)
+7 −0
Original line number Diff line number Diff line
@@ -5,6 +5,8 @@
#include "test_utils.hpp"
#include "token_collector.hpp"
#include "xacc_service.hpp"
#include "qcor_config.hpp"
#include "xacc_config.hpp"

TEST(PyXASMTokenCollectorTester, checkSimple) {
  LexerHelper helper;
@@ -74,6 +76,11 @@ quantum::x(qb[i]);
}

int main(int argc, char **argv) {
  std::string xacc_config_install_dir = std::string(XACC_INSTALL_DIR);
  std::string qcor_root = std::string(QCOR_INSTALL_DIR);
  if (xacc_config_install_dir != qcor_root) {
    xacc::addPluginSearchPath(std::string(QCOR_INSTALL_DIR) + "/plugins");
  }
  xacc::Initialize();
  ::testing::InitGoogleTest(&argc, argv);
  auto ret = RUN_ALL_TESTS();
+1 −1
Original line number Diff line number Diff line
@@ -5,6 +5,6 @@ configure_file(StaqTokenCollectorTester.in.cpp
link_directories(${XACC_ROOT}/lib)
add_executable(StaqTokenCollectorTester ${CMAKE_BINARY_DIR}/handlers/token_collector/staq/tests/StaqTokenCollectorTester.cpp)
add_test(NAME qcor_StaqTokenCollectorTester COMMAND StaqTokenCollectorTester)
target_include_directories(StaqTokenCollectorTester PRIVATE . ../../ ../../tests ${XACC_ROOT}/include/gtest)
target_include_directories(StaqTokenCollectorTester PRIVATE . ../../ ../../tests ${CMAKE_BINARY_DIR} ${XACC_ROOT}/include/gtest)
target_link_libraries(StaqTokenCollectorTester ${XACC_TEST_LIBRARIES} xacc::xacc test_utils)
configure_file(${CMAKE_SOURCE_DIR}/examples/adder/add_3_5.v ${CMAKE_BINARY_DIR}/handlers/token_collector/staq/tests COPYONLY)
+15 −8
Original line number Diff line number Diff line
#include "test_utils.hpp"
#include "token_collector.hpp"
#include "xacc_service.hpp"
#include <xacc.hpp>

#include "clang/Sema/DeclSpec.h"
#include "gtest/gtest.h"
#include <xacc.hpp>
#include "qalloc.hpp"
#include "qcor_config.hpp"
#include "test_utils.hpp"
#include "token_collector.hpp"
#include "xacc_config.hpp"
#include "xacc_service.hpp"

TEST(StaqTokenCollectorTester, checkSimple) {
  
  LexerHelper helper;

  auto [tokens, PP] =
      helper.Lex(R"#(oracle adder a0,a1,a2,a3,b0,b1,b2,b3,c0,c1,c2,c3 { "@CMAKE_BINARY_DIR@/handlers/token_collector/staq/tests/add_3_5.v" }
  auto [tokens, PP] = helper.Lex(
      R"#(oracle adder a0,a1,a2,a3,b0,b1,b2,b3,c0,c1,c2,c3 { "@CMAKE_BINARY_DIR@/handlers/token_collector/staq/tests/add_3_5.v" }

  creg result[4];
  // a = 3
@@ -260,6 +262,11 @@ quantum::mz(c[3]);
}

int main(int argc, char **argv) {
  std::string xacc_config_install_dir = std::string(XACC_INSTALL_DIR);
  std::string qcor_root = std::string(QCOR_INSTALL_DIR);
  if (xacc_config_install_dir != qcor_root) {
    xacc::addPluginSearchPath(std::string(QCOR_INSTALL_DIR) + "/plugins");
  }
  xacc::Initialize();
  ::testing::InitGoogleTest(&argc, argv);
  auto ret = RUN_ALL_TESTS();
+7 −0
Original line number Diff line number Diff line
@@ -4,6 +4,8 @@
#include "clang/Sema/DeclSpec.h"
#include "gtest/gtest.h"
#include <xacc.hpp>
#include "xacc_config.hpp"
#include "qcor_config.hpp"

TEST(TokenCollectorTester, checkSimple) {

@@ -165,6 +167,11 @@ quantum::mz(qb[i]);
            results);
}
int main(int argc, char **argv) {
  std::string xacc_config_install_dir = std::string(XACC_INSTALL_DIR);
  std::string qcor_root = std::string(QCOR_INSTALL_DIR);
  if (xacc_config_install_dir != qcor_root) {
    xacc::addPluginSearchPath(std::string(QCOR_INSTALL_DIR) + "/plugins");
  }
  xacc::Initialize();
  ::testing::InitGoogleTest(&argc, argv);
  auto ret = RUN_ALL_TESTS();
Loading