On Fri, 20 May 2022 at 03:20, Hans-Peter Nilsson via Libstdc++
<libstd...@gcc.gnu.org> wrote:
>
> Also, how about shortening those test-suite file-paths?
> They're path sort-of overlong for any git (and ChangeLog)
> commit-line limit. 1/2 :-)

Yes, they're silly. I like what libc++ does, i.e. name the testsuite
directories after the [stable.name] tags in the standard. They have
std/rand/rand.dis/rand.dist.bern/rand.dist.bern.negbin (for some
reason they use "rand.dis" instead of "rand.dist" for the third
component there, which is not what the standard has,
https://eel.is/c++draft/rand.dist.bern.negbin shows the subclause
hierarchy).

That's still quite unwieldy, so we could remove the repetition and use
26_numerics/rand/dist/bernoulli/negbin/. The problem now is that it
gets quite cryptic, so finding the tests for the
negative_binomial_distribution is a bit harder if you don't know where
to look (but git grep solves that in less than a second).



>
> Ok to commit (without renaming)?

I'm OK with the timeout factor, but we could also solve it differently
so that it doesn't take nearly 5 minutes, as in the attached patch.
The testDiscreteDist function can be parametrized with the number of
iterations to perform. Would you rather do that?
diff --git 
a/libstdc++-v3/testsuite/26_numerics/random/negative_binomial_distribution/operators/values.cc
 
b/libstdc++-v3/testsuite/26_numerics/random/negative_binomial_distribution/operators/values.cc
index dda6f43b254..a3120401d09 100644
--- 
a/libstdc++-v3/testsuite/26_numerics/random/negative_binomial_distribution/operators/values.cc
+++ 
b/libstdc++-v3/testsuite/26_numerics/random/negative_binomial_distribution/operators/values.cc
@@ -26,6 +26,14 @@
 #include <functional>
 #include <testsuite_random.h>
 
+// { dg-options "-DSIMULATOR_TEST" { target simulator } }
+
+#ifdef SIMULATOR_TEST
+# define ARGS 100, 1000
+#else
+# define ARGS
+#endif
+
 void test01()
 {
   using namespace __gnu_test;
@@ -34,18 +42,18 @@ void test01()
 
   std::negative_binomial_distribution<> nbd1(5, 0.3);
   auto bnbd1 = std::bind(nbd1, eng);
-  testDiscreteDist(bnbd1, [](int n)
-                  { return negative_binomial_pdf(n, 5, 0.3); } );
+  testDiscreteDist<ARGS>(bnbd1, [](int n)
+                        { return negative_binomial_pdf(n, 5, 0.3); } );
 
   std::negative_binomial_distribution<> nbd2(55, 0.3);
   auto bnbd2 = std::bind(nbd2, eng);
-  testDiscreteDist(bnbd2, [](int n)
-                  { return negative_binomial_pdf(n, 55, 0.3); } );
+  testDiscreteDist<ARGS>(bnbd2, [](int n)
+                        { return negative_binomial_pdf(n, 55, 0.3); } );
 
   std::negative_binomial_distribution<> nbd3(10, 0.75);
   auto bnbd3 = std::bind(nbd3, eng);
-  testDiscreteDist(bnbd3, [](int n)
-                  { return negative_binomial_pdf(n, 10, 0.75); } );
+  testDiscreteDist<ARGS>(bnbd3, [](int n)
+                        { return negative_binomial_pdf(n, 10, 0.75); } );
 }
 
 int main()

Reply via email to