Skip to content

Conversation

@hiraditya
Copy link
Collaborator

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

@hiraditya hiraditya requested a review from a team as a code owner March 1, 2025 18:44
@llvmbot llvmbot added the libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi. label Mar 1, 2025
@hiraditya hiraditya requested review from serge-sans-paille and removed request for a team March 1, 2025 18:45
@llvmbot
Copy link
Member

llvmbot commented Mar 1, 2025

@llvm/pr-subscribers-libcxx

Author: AdityaK (hiraditya)

Changes

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


Full diff: https://github.com/llvm/llvm-project/pull/129395.diff

1 Files Affected:

  • (modified) libcxx/test/std/numerics/numeric.ops/numeric.ops.gcd/gcd.pass.cpp (+1-1)
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)

@hiraditya hiraditya requested a review from a team March 1, 2025 18:45
@github-actions
Copy link

github-actions bot commented Mar 1, 2025

✅ With the latest revision this PR passed the C/C++ code formatter.

@colincross identified gcd does not have a single case whose answer is not 0, 1, or the smaller of the two inputs.
@serge-sans-paille
Copy link
Collaborator

do_fuzzy_tests<...>() does do more than what's mentioned in the commit message but I'm all in for extra deterministic values.

The freebsd errors seem unrelated (thread_create_failure.pass.cpp?)

@philnik777 philnik777 changed the title gcd: Add more tests that require few more divisions [libc++] Add tests for gcd that result in something other than zero or one Mar 2, 2025
@philnik777 philnik777 merged commit 4a8412d into llvm:main Mar 2, 2025
81 of 85 checks passed
@hiraditya hiraditya deleted the gcd branch March 3, 2025 21:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants