| 29 | } |
| 30 | |
| 31 | TEST(Api, ivalue) { |
| 32 | std::uniform_real_distribution<> dist(-100, 100); |
| 33 | std::uniform_int_distribution<> dist_bool(0, 1); |
| 34 | |
| 35 | const auto v_int = static_cast<int>(dist(rng)); |
| 36 | ASSERT_EQ(IValue(v_int).ToInt(), v_int); |
| 37 | |
| 38 | const auto v_int64 = static_cast<int64_t>(dist(rng)); |
| 39 | ASSERT_EQ(IValue(v_int64).ToInt(), v_int64); |
| 40 | |
| 41 | const auto v_float = static_cast<float>(dist(rng)); |
| 42 | ASSERT_EQ(IValue(v_float).ToDouble(), v_float); |
| 43 | |
| 44 | const auto v_double = static_cast<double>(dist(rng)); |
| 45 | ASSERT_EQ(IValue(v_double).ToDouble(), v_double); |
| 46 | |
| 47 | const auto v_bool = static_cast<bool>(dist_bool(rng)); |
| 48 | ASSERT_EQ(IValue(v_bool).ToBool(), v_bool); |
| 49 | } |
| 50 | |
| 51 | TEST(Api, ivalue_tensor) { |
| 52 | EnvScope scope; |
nothing calls this directly
no test coverage detected