[libc++] Add tests for gcd that result in something other than zero or one (#129395)

@colincross identified gcd does not have a single case whose answer is
not 0, 1, or the smaller of the two inputs.
This commit is contained in:
AdityaK 2025-03-02 02:33:59 -08:00 committed by GitHub
parent 4b3f0fa7e7
commit 4a8412d430
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -27,7 +27,19 @@ constexpr struct {
int x;
int y;
int expect;
} Cases[] = {{0, 0, 0}, {1, 0, 1}, {0, 1, 1}, {1, 1, 1}, {2, 3, 1}, {2, 4, 2}, {11, 9, 1}, {36, 17, 1}, {36, 18, 18}};
} Cases[] = {
{0, 0, 0},
{1, 0, 1},
{0, 1, 1},
{1, 1, 1},
{2, 3, 1},
{2, 4, 2},
{11, 9, 1},
{36, 17, 1},
{36, 18, 18},
{25, 30, 5},
{24, 16, 8},
{128, 100, 4}};
template <typename Input1, typename Input2, typename Output>
constexpr bool test0(int in1, int in2, int out)