diff mbox

Random shuffle moveable: container size

Message ID 1444311312-3389-1-git-send-email-aurelio.remonda@tallertechnologies.com
State New
Headers show

Commit Message

Aurelio Remonda Oct. 8, 2015, 1:35 p.m. UTC
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(-)

Comments

Jonathan Wakely Oct. 13, 2015, 9:26 a.m. UTC | #1
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.
Aurelio Remonda Oct. 13, 2015, 12:57 p.m. UTC | #2
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
Jonathan Wakely Oct. 16, 2015, 11:12 a.m. UTC | #3
Committed to trunk, thanks for the patch.
diff mbox

Patch

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