Skip to content

Commit 4a8412d

Browse files
authored
[libc++] Add tests for gcd that result in something other than zero or one (llvm#129395)
@colincross identified gcd does not have a single case whose answer is not 0, 1, or the smaller of the two inputs.
1 parent 4b3f0fa commit 4a8412d

File tree

1 file changed

+13
-1
lines changed
  • libcxx/test/std/numerics/numeric.ops/numeric.ops.gcd

1 file changed

+13
-1
lines changed

libcxx/test/std/numerics/numeric.ops/numeric.ops.gcd/gcd.pass.cpp

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,19 @@ constexpr struct {
2727
int x;
2828
int y;
2929
int expect;
30-
} 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}};
30+
} Cases[] = {
31+
{0, 0, 0},
32+
{1, 0, 1},
33+
{0, 1, 1},
34+
{1, 1, 1},
35+
{2, 3, 1},
36+
{2, 4, 2},
37+
{11, 9, 1},
38+
{36, 17, 1},
39+
{36, 18, 18},
40+
{25, 30, 5},
41+
{24, 16, 8},
42+
{128, 100, 4}};
3143

3244
template <typename Input1, typename Input2, typename Output>
3345
constexpr bool test0(int in1, int in2, int out)

0 commit comments

Comments
 (0)