xref: /aosp_15_r20/external/pytorch/android/pytorch_android/src/androidTest/cpp/pytorch_jni_common_test.cpp (revision da0073e96a02ea20f0ac840b70461e3646d07c45)
1 // Copyright (c) Meta Platforms, Inc. and affiliates.
2 //
3 // This source code is licensed under the BSD-style license found in the
4 // LICENSE file in the root directory of this source tree.
5 
6 #include <gtest/gtest.h>
7 
8 #include <ATen/core/type_factory.h>
9 #include "caffe2/android/pytorch_android/src/main/cpp/pytorch_jni_common.h"
10 
11 using namespace ::testing;
12 
TEST(pytorch_jni_common_test,newJIValueFromAtIValue)13 TEST(pytorch_jni_common_test, newJIValueFromAtIValue) {
14   auto dict = c10::impl::GenericDict(
15       c10::dynT<c10::IntType>(), c10::dynT<c10::StringType>());
16   auto dictCallback = [](auto&&) {
17     return facebook::jni::local_ref<pytorch_jni::JIValue>{};
18   };
19   EXPECT_NO_THROW(pytorch_jni::JIValue::newJIValueFromAtIValue(
20       dict, dictCallback, dictCallback));
21 }
22