Skip to content

Commit

Permalink
Refactor unit tests location and groups
Browse files Browse the repository at this point in the history
  • Loading branch information
NonStatic2014 committed Apr 18, 2019
1 parent 0c67e6d commit c9f8abd
Show file tree
Hide file tree
Showing 7 changed files with 60 additions and 60 deletions.
10 changes: 5 additions & 5 deletions cmake/onnxruntime_unittests.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -540,14 +540,14 @@ endif()

if (onnxruntime_BUILD_HOSTING)
file(GLOB onnxruntime_test_hosting_src
"${TEST_SRC_DIR}/hosting/*.cc"
"${TEST_SRC_DIR}/hosting/*.h"
"${TEST_SRC_DIR}/hosting/unit_tests/*.cc"
"${TEST_SRC_DIR}/hosting/unit_tests/*.h"
)
if(NOT WIN32)
if(HAS_UNUSED_PARAMETER)
set_source_files_properties("${TEST_SRC_DIR}/hosting/json_handling_tests.cc" PROPERTIES COMPILE_FLAGS -Wno-unused-parameter)
set_source_files_properties("${TEST_SRC_DIR}/hosting/converter_tests.cc" PROPERTIES COMPILE_FLAGS -Wno-unused-parameter)
set_source_files_properties("${TEST_SRC_DIR}/hosting/util_tests.cc" PROPERTIES COMPILE_FLAGS -Wno-unused-parameter)
set_source_files_properties("${TEST_SRC_DIR}/hosting/unit_tests/json_handling_tests.cc" PROPERTIES COMPILE_FLAGS -Wno-unused-parameter)
set_source_files_properties("${TEST_SRC_DIR}/hosting/unit_tests/converter_tests.cc" PROPERTIES COMPILE_FLAGS -Wno-unused-parameter)
set_source_files_properties("${TEST_SRC_DIR}/hosting/unit_tests/util_tests.cc" PROPERTIES COMPILE_FLAGS -Wno-unused-parameter)
endif()
endif()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ IExecutionProvider* TestCPUExecutionProvider() {
return &cpu_provider;
}

TEST(PositiveTests, MLDataTypeToTensorProtoDataTypeTests) {
TEST(MLDataTypeToTensorProtoDataTypeTests, MLDataTypeToTensorProtoDataTypeTests) {
auto logger = std::make_unique<onnxruntime::logging::Logger>(::onnxruntime::test::DefaultLoggingManager().DefaultLogger());

MLDataType ml_data_type = DataTypeImpl::GetType<float>();
Expand Down Expand Up @@ -86,7 +86,7 @@ TEST(PositiveTests, MLDataTypeToTensorProtoDataTypeTests) {
EXPECT_EQ(result, onnx::TensorProto_DataType_UNDEFINED);
}

TEST(PositiveTests, MLValueToTensorProtoTests_FloatToRaw) {
TEST(MLValueToTensorProtoTests, FloatToRaw) {
auto logger = std::make_unique<onnxruntime::logging::Logger>(::onnxruntime::test::DefaultLoggingManager().DefaultLogger());

std::vector<int64_t> dims_mul_x = {3, 2};
Expand Down Expand Up @@ -125,7 +125,7 @@ TEST(PositiveTests, MLValueToTensorProtoTests_FloatToRaw) {
}
}

TEST(PositiveTests, MLValueToTensorProtoTests_FloatToFloatData) {
TEST(MLValueToTensorProtoTests, FloatToFloatData) {
auto logger = std::make_unique<onnxruntime::logging::Logger>(::onnxruntime::test::DefaultLoggingManager().DefaultLogger());

std::vector<int64_t> dims_mul_x = {3, 2};
Expand Down Expand Up @@ -160,7 +160,7 @@ TEST(PositiveTests, MLValueToTensorProtoTests_FloatToFloatData) {
}
}

TEST(PositiveTests, MLValueToTensorProtoTests_Int32ToRaw) {
TEST(MLValueToTensorProtoTests, Int32ToRaw) {
auto logger = std::make_unique<onnxruntime::logging::Logger>(::onnxruntime::test::DefaultLoggingManager().DefaultLogger());

std::vector<int64_t> dims_mul_x = {3, 2};
Expand Down Expand Up @@ -199,7 +199,7 @@ TEST(PositiveTests, MLValueToTensorProtoTests_Int32ToRaw) {
}
}

TEST(PositiveTests, MLValueToTensorProtoTests_Int32ToInt32Data) {
TEST(MLValueToTensorProtoTests, Int32ToInt32Data) {
auto logger = std::make_unique<onnxruntime::logging::Logger>(::onnxruntime::test::DefaultLoggingManager().DefaultLogger());

std::vector<int64_t> dims_mul_x = {3, 2};
Expand Down Expand Up @@ -234,7 +234,7 @@ TEST(PositiveTests, MLValueToTensorProtoTests_Int32ToInt32Data) {
}
}

TEST(PositiveTests, MLValueToTensorProtoTests_UInt8ToRaw) {
TEST(MLValueToTensorProtoTests, UInt8ToRaw) {
auto logger = std::make_unique<onnxruntime::logging::Logger>(::onnxruntime::test::DefaultLoggingManager().DefaultLogger());

std::vector<int64_t> dims_mul_x = {3, 2};
Expand Down Expand Up @@ -273,7 +273,7 @@ TEST(PositiveTests, MLValueToTensorProtoTests_UInt8ToRaw) {
}
}

TEST(PositiveTests, MLValueToTensorProtoTests_UInt8ToInt32Data) {
TEST(MLValueToTensorProtoTests, UInt8ToInt32Data) {
auto logger = std::make_unique<onnxruntime::logging::Logger>(::onnxruntime::test::DefaultLoggingManager().DefaultLogger());

std::vector<int64_t> dims_mul_x = {3, 2};
Expand Down Expand Up @@ -310,7 +310,7 @@ TEST(PositiveTests, MLValueToTensorProtoTests_UInt8ToInt32Data) {
}
}

TEST(PositiveTests, MLValueToTensorProtoTests_Int8ToRaw) {
TEST(MLValueToTensorProtoTests, Int8ToRaw) {
auto logger = std::make_unique<onnxruntime::logging::Logger>(::onnxruntime::test::DefaultLoggingManager().DefaultLogger());

std::vector<int64_t> dims_mul_x = {3, 2};
Expand Down Expand Up @@ -349,7 +349,7 @@ TEST(PositiveTests, MLValueToTensorProtoTests_Int8ToRaw) {
}
}

TEST(PositiveTests, MLValueToTensorProtoTests_Int8ToInt32Data) {
TEST(MLValueToTensorProtoTests, Int8ToInt32Data) {
auto logger = std::make_unique<onnxruntime::logging::Logger>(::onnxruntime::test::DefaultLoggingManager().DefaultLogger());

std::vector<int64_t> dims_mul_x = {3, 2};
Expand Down Expand Up @@ -386,7 +386,7 @@ TEST(PositiveTests, MLValueToTensorProtoTests_Int8ToInt32Data) {
}
}

TEST(PositiveTests, MLValueToTensorProtoTests_UInt16ToRaw) {
TEST(MLValueToTensorProtoTests, UInt16ToRaw) {
auto logger = std::make_unique<onnxruntime::logging::Logger>(::onnxruntime::test::DefaultLoggingManager().DefaultLogger());

std::vector<int64_t> dims_mul_x = {3, 3};
Expand Down Expand Up @@ -425,7 +425,7 @@ TEST(PositiveTests, MLValueToTensorProtoTests_UInt16ToRaw) {
}
}

TEST(PositiveTests, MLValueToTensorProtoTests_UInt16ToInt32Data) {
TEST(MLValueToTensorProtoTests, UInt16ToInt32Data) {
auto logger = std::make_unique<onnxruntime::logging::Logger>(::onnxruntime::test::DefaultLoggingManager().DefaultLogger());

std::vector<int64_t> dims_mul_x = {3, 3};
Expand Down Expand Up @@ -462,7 +462,7 @@ TEST(PositiveTests, MLValueToTensorProtoTests_UInt16ToInt32Data) {
}
}

TEST(PositiveTests, MLValueToTensorProtoTests_Int16ToRaw) {
TEST(MLValueToTensorProtoTests, Int16ToRaw) {
auto logger = std::make_unique<onnxruntime::logging::Logger>(::onnxruntime::test::DefaultLoggingManager().DefaultLogger());

std::vector<int64_t> dims_mul_x = {3, 2};
Expand Down Expand Up @@ -501,7 +501,7 @@ TEST(PositiveTests, MLValueToTensorProtoTests_Int16ToRaw) {
}
}

TEST(PositiveTests, MLValueToTensorProtoTests_Int16ToInt32Data) {
TEST(MLValueToTensorProtoTests, Int16ToInt32Data) {
auto logger = std::make_unique<onnxruntime::logging::Logger>(::onnxruntime::test::DefaultLoggingManager().DefaultLogger());

std::vector<int64_t> dims_mul_x = {3, 2};
Expand Down Expand Up @@ -538,7 +538,7 @@ TEST(PositiveTests, MLValueToTensorProtoTests_Int16ToInt32Data) {
}
}

TEST(PositiveTests, MLValueToTensorProtoTests_BoolToRaw) {
TEST(MLValueToTensorProtoTests, BoolToRaw) {
auto logger = std::make_unique<onnxruntime::logging::Logger>(::onnxruntime::test::DefaultLoggingManager().DefaultLogger());

std::vector<int64_t> dims_mul_x = {3, 2};
Expand Down Expand Up @@ -577,7 +577,7 @@ TEST(PositiveTests, MLValueToTensorProtoTests_BoolToRaw) {
}
}

TEST(PositiveTests, MLValueToTensorProtoTests_BoolToInt32Data) {
TEST(MLValueToTensorProtoTests, BoolToInt32Data) {
auto logger = std::make_unique<onnxruntime::logging::Logger>(::onnxruntime::test::DefaultLoggingManager().DefaultLogger());

std::vector<int64_t> dims_mul_x = {3, 2};
Expand Down Expand Up @@ -614,7 +614,7 @@ TEST(PositiveTests, MLValueToTensorProtoTests_BoolToInt32Data) {
}
}

TEST(PositiveTests, MLValueToTensorProtoTests_Float16ToRaw) {
TEST(MLValueToTensorProtoTests, Float16ToRaw) {
auto logger = std::make_unique<onnxruntime::logging::Logger>(::onnxruntime::test::DefaultLoggingManager().DefaultLogger());

std::vector<int64_t> dims_mul_x = {3, 2};
Expand Down Expand Up @@ -659,7 +659,7 @@ TEST(PositiveTests, MLValueToTensorProtoTests_Float16ToRaw) {
}
}

TEST(PositiveTests, MLValueToTensorProtoTests_FloatToInt32Data) {
TEST(MLValueToTensorProtoTests, FloatToInt32Data) {
auto logger = std::make_unique<onnxruntime::logging::Logger>(::onnxruntime::test::DefaultLoggingManager().DefaultLogger());

std::vector<int64_t> dims_mul_x = {3, 2};
Expand Down Expand Up @@ -702,7 +702,7 @@ TEST(PositiveTests, MLValueToTensorProtoTests_FloatToInt32Data) {
}
}

TEST(PositiveTests, MLValueToTensorProtoTests_BFloat16ToRaw) {
TEST(MLValueToTensorProtoTests, BFloat16ToRaw) {
auto logger = std::make_unique<onnxruntime::logging::Logger>(::onnxruntime::test::DefaultLoggingManager().DefaultLogger());

std::vector<int64_t> dims_mul_x = {3, 2};
Expand Down Expand Up @@ -747,7 +747,7 @@ TEST(PositiveTests, MLValueToTensorProtoTests_BFloat16ToRaw) {
}
}

TEST(PositiveTests, MLValueToTensorProtoTests_BFloatToInt32Data) {
TEST(MLValueToTensorProtoTests, BFloatToInt32Data) {
auto logger = std::make_unique<onnxruntime::logging::Logger>(::onnxruntime::test::DefaultLoggingManager().DefaultLogger());

std::vector<int64_t> dims_mul_x = {3, 2};
Expand Down Expand Up @@ -790,7 +790,7 @@ TEST(PositiveTests, MLValueToTensorProtoTests_BFloatToInt32Data) {
}
}

TEST(PositiveTests, MLValueToTensorProtoTests_StringToStringData) {
TEST(MLValueToTensorProtoTests, StringToStringData) {
auto logger = std::make_unique<onnxruntime::logging::Logger>(::onnxruntime::test::DefaultLoggingManager().DefaultLogger());

std::vector<int64_t> dims_mul_x = {3, 2};
Expand Down Expand Up @@ -832,7 +832,7 @@ TEST(PositiveTests, MLValueToTensorProtoTests_StringToStringData) {
}
}

TEST(PositiveTests, MLValueToTensorProtoTests_Int64ToRaw) {
TEST(MLValueToTensorProtoTests, Int64ToRaw) {
auto logger = std::make_unique<onnxruntime::logging::Logger>(::onnxruntime::test::DefaultLoggingManager().DefaultLogger());

std::vector<int64_t> dims_mul_x = {3, 2};
Expand Down Expand Up @@ -871,7 +871,7 @@ TEST(PositiveTests, MLValueToTensorProtoTests_Int64ToRaw) {
}
}

TEST(PositiveTests, MLValueToTensorProtoTests_Int64ToInt64Data) {
TEST(MLValueToTensorProtoTests, Int64ToInt64Data) {
auto logger = std::make_unique<onnxruntime::logging::Logger>(::onnxruntime::test::DefaultLoggingManager().DefaultLogger());

std::vector<int64_t> dims_mul_x = {3, 2};
Expand Down Expand Up @@ -906,7 +906,7 @@ TEST(PositiveTests, MLValueToTensorProtoTests_Int64ToInt64Data) {
}
}

TEST(PositiveTests, MLValueToTensorProtoTests_UInt32ToRaw) {
TEST(MLValueToTensorProtoTests, UInt32ToRaw) {
auto logger = std::make_unique<onnxruntime::logging::Logger>(::onnxruntime::test::DefaultLoggingManager().DefaultLogger());

std::vector<int64_t> dims_mul_x = {3, 2};
Expand Down Expand Up @@ -945,7 +945,7 @@ TEST(PositiveTests, MLValueToTensorProtoTests_UInt32ToRaw) {
}
}

TEST(PositiveTests, MLValueToTensorProtoTests_UInt32ToUint64Data) {
TEST(MLValueToTensorProtoTests, UInt32ToUint64Data) {
auto logger = std::make_unique<onnxruntime::logging::Logger>(::onnxruntime::test::DefaultLoggingManager().DefaultLogger());

std::vector<int64_t> dims_mul_x = {3, 2};
Expand Down Expand Up @@ -983,7 +983,7 @@ TEST(PositiveTests, MLValueToTensorProtoTests_UInt32ToUint64Data) {
}
}

TEST(PositiveTests, MLValueToTensorProtoTests_UInt64ToRaw) {
TEST(MLValueToTensorProtoTests, UInt64ToRaw) {
auto logger = std::make_unique<onnxruntime::logging::Logger>(::onnxruntime::test::DefaultLoggingManager().DefaultLogger());

std::vector<int64_t> dims_mul_x = {3, 2};
Expand Down Expand Up @@ -1022,7 +1022,7 @@ TEST(PositiveTests, MLValueToTensorProtoTests_UInt64ToRaw) {
}
}

TEST(PositiveTests, MLValueToTensorProtoTests_UInt64ToInt64Data) {
TEST(MLValueToTensorProtoTests, UInt64ToInt64Data) {
auto logger = std::make_unique<onnxruntime::logging::Logger>(::onnxruntime::test::DefaultLoggingManager().DefaultLogger());

std::vector<int64_t> dims_mul_x = {3, 2};
Expand Down Expand Up @@ -1057,7 +1057,7 @@ TEST(PositiveTests, MLValueToTensorProtoTests_UInt64ToInt64Data) {
}
}

TEST(PositiveTests, MLValueToTensorProtoTests_DoubleToRaw) {
TEST(MLValueToTensorProtoTests, DoubleToRaw) {
auto logger = std::make_unique<onnxruntime::logging::Logger>(::onnxruntime::test::DefaultLoggingManager().DefaultLogger());

std::vector<int64_t> dims_mul_x = {3, 2};
Expand Down Expand Up @@ -1096,7 +1096,7 @@ TEST(PositiveTests, MLValueToTensorProtoTests_DoubleToRaw) {
}
}

TEST(PositiveTests, MLValueToTensorProtoTests_DoubleToInt64Data) {
TEST(MLValueToTensorProtoTests, DoubleToInt64Data) {
auto logger = std::make_unique<onnxruntime::logging::Logger>(::onnxruntime::test::DefaultLoggingManager().DefaultLogger());

std::vector<int64_t> dims_mul_x = {3, 2};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ void do_something(const std::string& name, const std::string& version,

void run_route(const std::string& pattern, http::verb method, const std::vector<test_data>& data, bool does_validate_data);

TEST(PositiveTests, RegisterTest) {
TEST(HttpRouteTests, RegisterTest) {
auto predict_regex = R"(/v1/models/([^/:]+)(?:/versions/(\d+))?:(classify|regress|predict))";
Routes routes;
EXPECT_TRUE(routes.RegisterController(http::verb::post, predict_regex, do_something));
Expand All @@ -28,7 +28,7 @@ TEST(PositiveTests, RegisterTest) {
EXPECT_TRUE(routes.RegisterController(http::verb::get, status_regex, do_something));
}

TEST(PositiveTests, PostRouteTest) {
TEST(HttpRouteTests, PostRouteTest) {
auto predict_regex = R"(/v1/models/([^/:]+)(?:/versions/(\d+))?:(classify|regress|predict))";

std::vector<test_data> actions{
Expand All @@ -41,7 +41,7 @@ TEST(PositiveTests, PostRouteTest) {
run_route(predict_regex, http::verb::post, actions, true);
}

TEST(NegativeTests, PostRouteInvalidURLTest) {
TEST(HttpRouteTests, PostRouteInvalidURLTest) {
auto predict_regex = R"(/v1/models/([^/:]+)(?:/versions/(\d+))?:(classify|regress|predict))";

std::vector<test_data> actions{
Expand All @@ -65,7 +65,7 @@ TEST(NegativeTests, PostRouteInvalidURLTest) {

// These tests are because we currently only support POST and GET
// Some HTTP methods should be removed from test data if we support more (e.g. PUT)
TEST(NegativeTests, PostRouteInvalidMethodTest) {
TEST(HttpRouteTests, PostRouteInvalidMethodTest) {
auto predict_regex = R"(/v1/models/([^/:]+)(?:/versions/(\d+))?:(classify|regress|predict))";

std::vector<test_data> actions{
Expand Down Expand Up @@ -104,6 +104,6 @@ void run_route(const std::string& pattern, http::verb method, const std::vector<
}
}

} // namespace test
} // namespace hosting
} // namespace onnxruntime
} // namespace test
} // namespace hosting
} // namespace onnxruntime
Loading

0 comments on commit c9f8abd

Please sign in to comment.