1#include <gtest/gtest.h>
2
3#include <c10/core/SymInt.h>
4#include <c10/core/SymNodeImpl.h>
5
6using namespace c10;
7#ifndef C10_MOBILE
8void check(int64_t value) {
9 EXPECT_TRUE(SymInt::check_range(value));
10 const auto i = SymInt(value);
11 EXPECT_FALSE(i.is_symbolic());
12 EXPECT_EQ(i.as_int_unchecked(), value);
13}
14
15TEST(SymIntTest, ConcreteInts) {
16 check(INT64_MAX);
17 check(0);
18 check(-1);
19 // This is 2^62, which is the most negative number we can support.
20 check(-4611686018427387904LL);
21}
22
23TEST(SymIntTest, CheckRange) {
24 EXPECT_FALSE(SymInt::check_range(INT64_MIN));
25}
26#endif
27