iinfo and scalar overflow detection (#2009)

This commit is contained in:
Awni Hannun
2025-03-27 19:54:56 -07:00
committed by GitHub
parent bc62932984
commit 5580b47291
6 changed files with 112 additions and 0 deletions

View File

@@ -55,3 +55,13 @@ TEST_CASE("test finfo") {
CHECK_EQ(finfo(float16).min, -65504);
CHECK_EQ(finfo(float16).max, 65504);
}
TEST_CASE("test iinfo") {
CHECK_EQ(iinfo(int8).dtype, int8);
CHECK_EQ(iinfo(int64).dtype, int64);
CHECK_EQ(iinfo(int64).max, std::numeric_limits<int64_t>::max());
CHECK_EQ(iinfo(uint64).max, std::numeric_limits<uint64_t>::max());
CHECK_EQ(iinfo(uint64).max, std::numeric_limits<uint64_t>::max());
CHECK_EQ(iinfo(uint64).min, 0);
CHECK_EQ(iinfo(int64).min, std::numeric_limits<int64_t>::min());
}