1/*******************************************************************************
2 Copyright (c) The Taichi Authors (2016- ). All Rights Reserved.
3 The use of this software is governed by the LICENSE file.
4*******************************************************************************/
5
6#define CATCH_CONFIG_RUNNER
7#include "taichi/util/testing.h"
8
9namespace taichi {
10
11int run_tests(std::vector<std::string> argv) {
12 char arg[] = "test";
13 std::vector<char *> argv_(1 + argv.size(), nullptr);
14 argv_[0] = arg;
15 for (int i = 0; i < (int)argv.size(); i++) {
16 argv_[i + 1] = const_cast<char *>(argv[i].c_str());
17 }
18 Catch::Session session;
19 int returnCode = session.applyCommandLine(1 + argv.size(), argv_.data());
20 if (returnCode != 0)
21 return returnCode;
22 return session.run();
23}
24
25} // namespace taichi
26