public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Random shuffle moveable: container size
@ 2015-10-08 13:35 Aurelio Remonda
  2015-10-13  9:26 ` Jonathan Wakely
  0 siblings, 1 reply; 4+ messages in thread
From: Aurelio Remonda @ 2015-10-08 13:35 UTC (permalink / raw)
  To: libstdc++, gcc-patches; +Cc: chris, daniel.gutson

This patch reduces the size of the array A (the array that contains
the values being shuffled) so the test can pass while running the
stdlibc++ testsuite.
It also make some minor changes such as:
*Deleting a useless call to fill_ascending function on test02.
*Changing N from const int to const unsigned int.
I have a company-wide copyright assignment, but I don't have commit access.

---
 ChangeLog   |  6 ++++++
 moveable.cc | 13 ++++++-------
 2 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index 91d2957..2c4e127 100644
--- a/libstdc++-v3/ChangeLog
+++ b/libstdc++-v3/ChangeLog
@@ -1,3 +1,9 @@
+2015-10-08  Aurelio Remonda  <aurelio.remonda@tallertechnologies.com>
+
+	* testsuite/25_algorithms/random_shuffle/moveable.cc: Change variable
+	N from const int N = 200000 to const unsigned int N = 10000.
+	Delete useless fill_ascending function call.
+
 2015-09-07  Jonathan Wakely  <jwakely@redhat.com>
 
 	* include/bits/shared_ptr_base.h (__shared_ptr::operator->): Change
diff --git a/libstdc++-v3/testsuite/25_algorithms/random_shuffle/moveable.cc b/libstdc++-v3/testsuite/25_algorithms/random_shuffle/moveable.cc
index e854c38..dabe9e3 100644
--- a/libstdc++-v3/testsuite/25_algorithms/random_shuffle/moveable.cc
+++ b/libstdc++-v3/testsuite/25_algorithms/random_shuffle/moveable.cc
@@ -34,8 +34,8 @@ using __gnu_test::rvalstruct;
 
 typedef test_container<rvalstruct, random_access_iterator_wrapper> Container;
 
-const int N = 200000;
-int A[N];
+const unsigned int N = 10000;
+int A[N]; // This is made global because we don't want it on the stack
 
 void fill_ascending()
 {
@@ -56,10 +56,10 @@ test01()
 
   // The chance that random_shuffle leaves the order as is by coincidence
   // is negligible, so we expect it to be permuted
-  VERIFY( !std::equal(rv, rv + N, A) );
+  VERIFY(!std::equal(rv, rv + N, A));
 
   std::sort(con.begin(), con.end());
-  VERIFY( std::equal(rv, rv + N, A) );
+  VERIFY(std::equal(rv, rv + N, A));
 }
 
 int random_generator(int)
@@ -70,14 +70,13 @@ test02()
 {
   bool test __attribute__((unused)) = true;
 
-  fill_ascending();
   rvalstruct rv[10] = {1,2,3,4,5,6,7,8,9,10};
   int result[10] = {10,1,2,3,4,5,6,7,8,9};
   Container con(rv, rv + 10);
   std::random_shuffle(con.begin(), con.end(), random_generator);
   // The above answer was generated by hand. It is not required by the standard,
   // but is produced by the current algorithm.
-  VERIFY( std::equal(rv, rv + 10, result) );
+  VERIFY(std::equal(rv, rv + 10, result));
 }
 
 int
@@ -86,4 +85,4 @@ main()
   test01();
   test02();
   return 0;
-}
+}
\ No newline at end of file
-- 
1.9.1

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Random shuffle moveable: container size
  2015-10-08 13:35 [PATCH] Random shuffle moveable: container size Aurelio Remonda
@ 2015-10-13  9:26 ` Jonathan Wakely
  2015-10-13 12:57   ` Aurelio Remonda
  0 siblings, 1 reply; 4+ messages in thread
From: Jonathan Wakely @ 2015-10-13  9:26 UTC (permalink / raw)
  To: Aurelio Remonda; +Cc: libstdc++, gcc-patches, chris, daniel.gutson

On 08/10/15 10:35 -0300, Aurelio Remonda wrote:
>This patch reduces the size of the array A (the array that contains
>the values being shuffled) so the test can pass while running the
>stdlibc++ testsuite.

Ahem! The project's name is libstdc++ !!! :-)


>It also make some minor changes such as:
>*Deleting a useless call to fill_ascending function on test02.
>*Changing N from const int to const unsigned int.
>I have a company-wide copyright assignment, but I don't have commit access.

OK, I will commit this (without the unnecessary whitespace changes).

Thanks.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Random shuffle moveable: container size
  2015-10-13  9:26 ` Jonathan Wakely
@ 2015-10-13 12:57   ` Aurelio Remonda
  2015-10-16 11:28     ` Jonathan Wakely
  0 siblings, 1 reply; 4+ messages in thread
From: Aurelio Remonda @ 2015-10-13 12:57 UTC (permalink / raw)
  To: Jonathan Wakely; +Cc: libstdc++, gcc-patches

On Tue, Oct 13, 2015 at 6:26 AM, Jonathan Wakely <jwakely@redhat.com> wrote:
> On 08/10/15 10:35 -0300, Aurelio Remonda wrote:
>>
>> This patch reduces the size of the array A (the array that contains
>> the values being shuffled) so the test can pass while running the
>> stdlibc++ testsuite.
>
>
> Ahem! The project's name is libstdc++ !!! :-)

:) My bad! Sorry about that!

>> It also make some minor changes such as:
>> *Deleting a useless call to fill_ascending function on test02.
>> *Changing N from const int to const unsigned int.
>> I have a company-wide copyright assignment, but I don't have commit
>> access.
>
>
> OK, I will commit this (without the unnecessary whitespace changes).
>
> Thanks.

Thank you!
Regards



-- 
Aurelio Remonda

Software Engineer

San Lorenzo 47, 3rd Floor, Office 5
Córdoba, Argentina
Phone: +54-351-4217888 / 4218211

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Random shuffle moveable: container size
  2015-10-13 12:57   ` Aurelio Remonda
@ 2015-10-16 11:28     ` Jonathan Wakely
  0 siblings, 0 replies; 4+ messages in thread
From: Jonathan Wakely @ 2015-10-16 11:28 UTC (permalink / raw)
  To: Aurelio Remonda; +Cc: libstdc++, gcc-patches

Committed to trunk, thanks for the patch.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-10-16 11:15 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-08 13:35 [PATCH] Random shuffle moveable: container size Aurelio Remonda
2015-10-13  9:26 ` Jonathan Wakely
2015-10-13 12:57   ` Aurelio Remonda
2015-10-16 11:28     ` Jonathan Wakely

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).