Hi, There are some useless variables, class Gt, and struct CompLast in
testsuite/25_algorithms/* This patch is to remove those useless variables, class Gt and struct CompLast. The patch is attached. commit d13ea592473ccbd29276908782877156e669b28a Author: Kai Zhao <loversz...@gmail.com> Date: Sat Aug 15 02:23:14 2015 +0800 2015-08-15 Kai Zhao <loversz...@gmail.com> testsuite/25_algorithms/nth_element/3.cc: Remove useless variables, class Gt, and struct CompLast. testsuite/25_algorithms/partial_sort/2.cc: Likewise. testsuite/25_algorithms/partial_sort_copy/2.cc: Likewise. testsuite/25_algorithms/sort/1.cc: Likewise. testsuite/25_algorithms/stable_sort/2.cc: Likewise. Thanks, Kai
commit d13ea592473ccbd29276908782877156e669b28a Author: Kai Zhao <loversz...@gmail.com> Date: Sat Aug 15 02:23:14 2015 +0800 2015-08-15 Kai Zhao <loversz...@gmail.com> testsuite/25_algorithms/nth_element/3.cc: Remove useless variables, class Gt, and struct CompLast. testsuite/25_algorithms/partial_sort/2.cc: Likewise. testsuite/25_algorithms/partial_sort_copy/2.cc: Likewise. testsuite/25_algorithms/sort/1.cc: Likewise. testsuite/25_algorithms/stable_sort/2.cc: Likewise. diff --git a/libstdc++-v3/testsuite/25_algorithms/nth_element/3.cc b/libstdc++-v3/testsuite/25_algorithms/nth_element/3.cc index 29a0450..4f9bc8a 100644 --- a/libstdc++-v3/testsuite/25_algorithms/nth_element/3.cc +++ b/libstdc++-v3/testsuite/25_algorithms/nth_element/3.cc @@ -26,8 +26,6 @@ const int A[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, const int B[] = {10, 20, 1, 11, 2, 12, 3, 13, 4, 14, 5, 15, 6, 16, 7, 17, 8, 18, 9, 19}; const int C[] = {20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1}; const int N = sizeof(A) / sizeof(int); -const int logN = 3; // ln(N) rounded up -const int P = 7; // comparison predicate for stable_sort: order by rightmost digit struct CompLast @@ -37,28 +35,6 @@ struct CompLast { return x % 10 < y % 10; } }; -// This functor has the equivalent functionality of std::geater<>, -// but there is no dependency on <functional> and it also tracks the -// number of invocations since creation. -class Gt -{ -public: - static int count() { return itsCount; } - static void reset() { itsCount = 0; } - - bool - operator()(const int& x, const int& y) - { - ++itsCount; - return x > y; - } - -private: - static int itsCount; -}; - -int Gt::itsCount = 0; - // 25.3.2 nth_element() void test05() diff --git a/libstdc++-v3/testsuite/25_algorithms/partial_sort/2.cc b/libstdc++-v3/testsuite/25_algorithms/partial_sort/2.cc index 4ec511a..f68cca5 100644 --- a/libstdc++-v3/testsuite/25_algorithms/partial_sort/2.cc +++ b/libstdc++-v3/testsuite/25_algorithms/partial_sort/2.cc @@ -26,39 +26,19 @@ const int A[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, const int B[] = {10, 20, 1, 11, 2, 12, 3, 13, 4, 14, 5, 15, 6, 16, 7, 17, 8, 18, 9, 19}; const int C[] = {20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1}; const int N = sizeof(A) / sizeof(int); -const int logN = 3; // ln(N) rounded up const int P = 7; -// comparison predicate for stable_sort: order by rightmost digit -struct CompLast -{ - bool - operator()(const int x, const int y) - { return x % 10 < y % 10; } -}; - // This functor has the equivalent functionality of std::geater<>, // but there is no dependency on <functional> and it also tracks the // number of invocations since creation. class Gt { public: - static int count() { return itsCount; } - static void reset() { itsCount = 0; } - bool operator()(const int& x, const int& y) - { - ++itsCount; - return x > y; - } - -private: - static int itsCount; + { return x > y; } }; -int Gt::itsCount = 0; - // 25.3.1.3 partial_sort() void test03() @@ -71,7 +51,6 @@ test03() VERIFY(std::equal(s1, s1 + P, A)); Gt gt; - gt.reset(); std::partial_sort(s1, s1 + P, s1 + N, gt); VERIFY(std::equal(s1, s1 + P, C)); } diff --git a/libstdc++-v3/testsuite/25_algorithms/partial_sort_copy/2.cc b/libstdc++-v3/testsuite/25_algorithms/partial_sort_copy/2.cc index 3659666..5943148 100644 --- a/libstdc++-v3/testsuite/25_algorithms/partial_sort_copy/2.cc +++ b/libstdc++-v3/testsuite/25_algorithms/partial_sort_copy/2.cc @@ -26,40 +26,19 @@ const int A[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, const int B[] = {10, 20, 1, 11, 2, 12, 3, 13, 4, 14, 5, 15, 6, 16, 7, 17, 8, 18, 9, 19}; const int C[] = {20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1}; const int N = sizeof(A) / sizeof(int); -const int logN = 3; // ln(N) rounded up const int P = 7; -// comparison predicate for stable_sort: order by rightmost digit -struct CompLast -{ - bool - operator()(const int x, const int y) - { return x % 10 < y % 10; } -}; - // This functor has the equivalent functionality of std::geater<>, // but there is no dependency on <functional> and it also tracks the // number of invocations since creation. class Gt { public: - static int count() { return itsCount; } - static void reset() { itsCount = 0; } - bool operator()(const int& x, const int& y) - { - ++itsCount; - return x > y; - } - -private: - static int itsCount; + { return x > y; } }; -int Gt::itsCount = 0; - - // 25.3.1.4 partial_sort_copy() void test04() @@ -76,7 +55,6 @@ test04() VERIFY(std::equal(s2, s2 + P, A)); Gt gt; - gt.reset(); partial_sort_copy(s1, s1 + N, s2, s2 + P, gt); VERIFY(std::equal(s2, s2 + P, C)); diff --git a/libstdc++-v3/testsuite/25_algorithms/sort/1.cc b/libstdc++-v3/testsuite/25_algorithms/sort/1.cc index 3ad6f02..7e52fa4 100644 --- a/libstdc++-v3/testsuite/25_algorithms/sort/1.cc +++ b/libstdc++-v3/testsuite/25_algorithms/sort/1.cc @@ -26,16 +26,6 @@ const int A[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, const int B[] = {10, 20, 1, 11, 2, 12, 3, 13, 4, 14, 5, 15, 6, 16, 7, 17, 8, 18, 9, 19}; const int C[] = {20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1}; const int N = sizeof(A) / sizeof(int); -const int logN = 3; // ln(N) rounded up -const int P = 7; - -// comparison predicate for stable_sort: order by rightmost digit -struct CompLast -{ - bool - operator()(const int x, const int y) - { return x % 10 < y % 10; } -}; // This functor has the equivalent functionality of std::geater<>, // but there is no dependency on <functional> and it also tracks the @@ -43,23 +33,11 @@ struct CompLast class Gt { public: - static int count() { return itsCount; } - static void reset() { itsCount = 0; } - bool operator()(const int& x, const int& y) - { - ++itsCount; - return x > y; - } - -private: - static int itsCount; + { return x > y; } }; -int Gt::itsCount = 0; - - // 25.3.1.1 sort() void test01() @@ -72,7 +50,6 @@ test01() VERIFY(std::equal(s1, s1 + N, A)); Gt gt; - gt.reset(); std::sort(s1, s1 + N, gt); VERIFY(std::equal(s1, s1 + N, C)); } diff --git a/libstdc++-v3/testsuite/25_algorithms/stable_sort/2.cc b/libstdc++-v3/testsuite/25_algorithms/stable_sort/2.cc index 584ae28..9c0dad0 100644 --- a/libstdc++-v3/testsuite/25_algorithms/stable_sort/2.cc +++ b/libstdc++-v3/testsuite/25_algorithms/stable_sort/2.cc @@ -27,7 +27,6 @@ const int B[] = {10, 20, 1, 11, 2, 12, 3, 13, 4, 14, 5, 15, 6, 16, 7, 17, 8, 18, const int C[] = {20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1}; const int N = sizeof(A) / sizeof(int); const int logN = 3; // ln(N) rounded up -const int P = 7; // comparison predicate for stable_sort: order by rightmost digit struct CompLast