[libcxx-commits] [libcxx] gcd: Add more tests that require few more divisions (PR #129395)

via libcxx-commits libcxx-commits at lists.llvm.org
Sat Mar 1 10:45:01 PST 2025


https://github.com/hiraditya created https://github.com/llvm/llvm-project/pull/129395

@colincross identified gcd does not have a single case whose answer is not 0, 1, or the smaller of the two inputs.

>From 43264013710e4276515fb224d21c8446d365bb44 Mon Sep 17 00:00:00 2001
From: AdityaK <hiraditya at msn.com>
Date: Sat, 1 Mar 2025 10:39:47 -0800
Subject: [PATCH] gcd: Add more tests that require few more divisions

@colincross identified gcd does not have a single case whose answer is not 0, 1, or the smaller of the two inputs.
---
 .../test/std/numerics/numeric.ops/numeric.ops.gcd/gcd.pass.cpp  | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libcxx/test/std/numerics/numeric.ops/numeric.ops.gcd/gcd.pass.cpp b/libcxx/test/std/numerics/numeric.ops/numeric.ops.gcd/gcd.pass.cpp
index 975b53a763afa..c5d3c127fc1ec 100644
--- a/libcxx/test/std/numerics/numeric.ops/numeric.ops.gcd/gcd.pass.cpp
+++ b/libcxx/test/std/numerics/numeric.ops/numeric.ops.gcd/gcd.pass.cpp
@@ -27,7 +27,7 @@ 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}, {256, 100, 4}};
 
 template <typename Input1, typename Input2, typename Output>
 constexpr bool test0(int in1, int in2, int out)



More information about the libcxx-commits mailing list