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

via libcxx-commits libcxx-commits at lists.llvm.org
Sun Mar 2 02:34:03 PST 2025


Author: AdityaK
Date: 2025-03-02T11:33:59+01:00
New Revision: 4a8412d4302e15db28a24b80af6902b9e267991b

URL: https://github.com/llvm/llvm-project/commit/4a8412d4302e15db28a24b80af6902b9e267991b
DIFF: https://github.com/llvm/llvm-project/commit/4a8412d4302e15db28a24b80af6902b9e267991b.diff

LOG: [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.

Added: 
    

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

Removed: 
    


################################################################################
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..456176a6444a9 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,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)


        


More information about the libcxx-commits mailing list