Files
pytorch/test/cpp/api/main.cpp.cpp
T
Peter Goldsborough afe3c2688f Update C++ API tests to use Catch2 (#7108)
* Update C++ API tests to use Catch2

* Update download_mnist.py to be less verbose
2018-04-30 21:36:35 -04:00

27 lines
644 B
C++

#define CATCH_CONFIG_RUNNER
#include <catch.hpp>
#include <torch/autograd.h>
#include <iostream>
// Custom main to disable CUDA tests when they are not available.
// https://github.com/catchorg/Catch2/blob/master/docs/own-main.md
int main(int argc, char* argv[]) {
Catch::Session session;
const auto return_code = session.applyCommandLine(argc, argv);
if (return_code != 0) {
return return_code;
}
if (!autograd::hasCuda()) {
std::cerr << "CUDA not available. Disabling CUDA tests" << std::endl;
// ~ disables the [cuda] tag.
session.configData().testsOrTags.push_back("~[cuda]");
}
return session.run();
}