Skip to content

Commit 1c941a9

Browse files
[cstdlib] Improve div tests
1 parent ae84288 commit 1c941a9

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

tests/cstdlib/div.t.cpp

+9-6
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,20 @@
66
template <typename T, typename F>
77
constexpr auto test(F func) -> bool
88
{
9-
CHECK(etl::div(T(2), T(1)).quot == T(2));
10-
CHECK(etl::div(T(2), T(1)).rem == T(0));
11-
12-
CHECK(etl::div(T(1), T(2)).quot == T(0));
13-
CHECK(etl::div(T(1), T(2)).rem == T(1));
14-
159
CHECK(func(T(2), T(1)).quot == T(2));
1610
CHECK(func(T(2), T(1)).rem == T(0));
1711

1812
CHECK(func(T(1), T(2)).quot == T(0));
1913
CHECK(func(T(1), T(2)).rem == T(1));
2014

15+
if constexpr (not etl::is_same_v<etl::intmax_t, long long>) {
16+
CHECK(etl::div(T(2), T(1)).quot == T(2));
17+
CHECK(etl::div(T(2), T(1)).rem == T(0));
18+
19+
CHECK(etl::div(T(1), T(2)).quot == T(0));
20+
CHECK(etl::div(T(1), T(2)).rem == T(1));
21+
}
22+
2123
return true;
2224
}
2325

@@ -26,6 +28,7 @@ constexpr auto test_all() -> bool
2628
CHECK(test<int>(static_cast<etl::div_t (*)(int, int)>(etl::div)));
2729
CHECK(test<long>(etl::ldiv));
2830
CHECK(test<long long>(etl::lldiv));
31+
CHECK(test<etl::intmax_t>(etl::imaxdiv));
2932
return true;
3033
}
3134

0 commit comments

Comments
 (0)