onnxruntime/onnxruntime/test/shared_lib/test_fixture.h
Ryan Hill 9129a652c5
Ryanunderhill/cxx api2 (#1091)
More C++ API improvements and cleanup
Add templates to tensor creation
Add run method that allows preallocated outputs
Simplify CreateTensor<T> to multiply by sizeof(T)
Convert io_types code
Optimize away vector copies in Session::Run
2019-05-24 11:15:51 -07:00

35 lines
908 B
C++

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
#include "core/session/onnxruntime_cxx_api.h"
#include <gtest/gtest.h>
#ifdef _WIN32
typedef const wchar_t* PATH_TYPE;
#define TSTR(X) L##X
#else
#define TSTR(X) (X)
typedef const char* PATH_TYPE;
#endif
//empty
static inline void ORT_API_CALL MyLoggingFunction(void*, OrtLoggingLevel, const char*, const char*, const char*, const char*) {
}
template <bool use_customer_logger>
class CApiTestImpl : public ::testing::Test {
protected:
Ort::Env env_{nullptr};
void SetUp() override {
if (use_customer_logger) {
env_ = Ort::Env(ORT_LOGGING_LEVEL_INFO, "Default", MyLoggingFunction, nullptr);
} else {
env_ = Ort::Env(ORT_LOGGING_LEVEL_INFO, "Default");
}
}
// Objects declared here can be used by all tests in the test case for Foo.
};
typedef CApiTestImpl<false> CApiTest;