gtest-ify JIT tests, through the letter c (#45020)

Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/45020

See https://github.com/pytorch/pytorch/pull/45018 for context.

Test Plan: Imported from OSS

Reviewed By: ZolotukhinM

Differential Revision: D23802296

Pulled By: suo

fbshipit-source-id: 20c9798a414e9ba30869a862012cbdee0613c8b1
This commit is contained in:
Michael Suo
2020-09-23 14:26:03 -07:00
committed by Facebook GitHub Bot
parent 3f89b779c4
commit d2b045030e
11 changed files with 287 additions and 299 deletions
+6 -6
View File
@@ -1,7 +1,7 @@
#include <test/cpp/jit/test_base.h>
#include <test/cpp/jit/test_utils.h>
#include <gtest/gtest.h>
#include <ATen/core/qualified_name.h>
#include <test/cpp/jit/test_utils.h>
#include <torch/csrc/jit/frontend/resolver.h>
#include <torch/csrc/jit/serialization/import_source.h>
#include <torch/torch.h>
@@ -45,7 +45,7 @@ static void import_libs(
si.loadType(QualifiedName(class_name));
}
void testClassImport() {
TEST(ClassImportTest, Basic) {
auto cu1 = std::make_shared<CompilationUnit>();
auto cu2 = std::make_shared<CompilationUnit>();
std::vector<at::IValue> constantTable;
@@ -80,7 +80,7 @@ void testClassImport() {
ASSERT_FALSE(c);
}
void testScriptObject() {
TEST(ClassImportTest, ScriptObject) {
Module m1("m1");
Module m2("m2");
std::vector<at::IValue> constantTable;
@@ -114,7 +114,7 @@ def __init__(self, x):
return x
)JIT";
void testClassDerive() {
TEST(ClassImportTest, ClassDerive) {
auto cu = std::make_shared<CompilationUnit>();
auto cls = ClassType::create("foo.bar", cu);
const auto self = SimpleSelf(cls);
@@ -142,7 +142,7 @@ class FooBar1234(Module):
return (self.f).top()
)JIT";
void testSaveLoadTorchbind() {
TEST(ClassImportTest, CustomClass) {
auto cu1 = std::make_shared<CompilationUnit>();
std::vector<at::IValue> constantTable;
// Import different versions of FooTest into two namespaces.