Skip to content

Commit

Permalink
format code
Browse files Browse the repository at this point in the history
  • Loading branch information
RandyShuai committed Jul 11, 2023
1 parent 3c9e80e commit 2baa70a
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions onnxruntime/test/shared_lib/test_inference.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3223,16 +3223,16 @@ TEST(MultiKernelSingleSchemaTest, DuplicateKernel) {
static std::thread::id caller_tid = std::this_thread::get_id();
static std::atomic_bool atomic_wait{false};

void callback_succeed(void* user_data, OrtValue** outputs, size_t num_outputs, OrtStatusPtr status_ptr) {
auto callee_tid = std::this_thread::get_id();
EXPECT_NE(*(reinterpret_cast<std::thread::id*>(user_data)), callee_tid);
Ort::Status status(status_ptr);
EXPECT_TRUE(status.IsOK());
EXPECT_EQ(num_outputs, 1UL);
Ort::Value output_value(outputs[0]);
EXPECT_EQ(output_value.At<float>({1, 0}), 9.f);
output_value.release();
atomic_wait.store(true);
void CallbackSucceed(void* user_data, OrtValue** outputs, size_t num_outputs, OrtStatusPtr status_ptr) {
auto callee_tid = std::this_thread::get_id();
EXPECT_NE(*(reinterpret_cast<std::thread::id*>(user_data)), callee_tid);
Ort::Status status(status_ptr);
EXPECT_TRUE(status.IsOK());
EXPECT_EQ(num_outputs, 1UL);
Ort::Value output_value(outputs[0]);
EXPECT_EQ(output_value.At<float>({1, 0}), 9.f);
output_value.release();
atomic_wait.store(true);
}

TEST(CApiTest, RunAsync) {
Expand Down Expand Up @@ -3260,7 +3260,7 @@ TEST(CApiTest, RunAsync) {
output_names,
output_values,
1,
callback_succeed,
CallbackSucceed,
&caller_tid));

std::chrono::duration<double, std::milli> dur{100};
Expand All @@ -3272,7 +3272,7 @@ TEST(CApiTest, RunAsync) {
EXPECT_EQ(atomic_wait.load(), true);
}

void callback_fail(void*, OrtValue**, size_t, OrtStatusPtr) {
void CallbackFail(void*, OrtValue**, size_t, OrtStatusPtr) {
EXPECT_TRUE(false); // the callback is not supposed to be invoked
}

Expand All @@ -3294,5 +3294,5 @@ TEST(CApiTest, RunAsyncFail) {
const char* output_names[] = {"Y"};

Ort::RunOptions run_options;
EXPECT_THROW(session.RunAsync(run_options, input_names, input_tensors, 1, output_names, output_values, 1, callback_fail, nullptr), std::exception);
EXPECT_THROW(session.RunAsync(run_options, input_names, input_tensors, 1, output_names, output_values, 1, CallbackFail, nullptr), std::exception);
}

0 comments on commit 2baa70a

Please sign in to comment.