Repository: thrift Updated Branches: refs/heads/master 3a724e37d -> 293a40e96
THRIFT-2745: c++ - fixed some unit test compilation on windows Client: C++-Library Patch: Sergei Nikulov unist.h removed THRIFT_SLEEP_USEC used instead of usleep ERROR variable renamed to TEST_TOLERANCE This closes #207 Project: http://git-wip-us.apache.org/repos/asf/thrift/repo Commit: http://git-wip-us.apache.org/repos/asf/thrift/commit/293a40e9 Tree: http://git-wip-us.apache.org/repos/asf/thrift/tree/293a40e9 Diff: http://git-wip-us.apache.org/repos/asf/thrift/diff/293a40e9 Branch: refs/heads/master Commit: 293a40e960d87d83ec57f89738c3ec174981335b Parents: 3a724e3 Author: Konrad Grochowski <[email protected]> Authored: Thu Sep 4 17:28:17 2014 +0400 Committer: Konrad Grochowski <[email protected]> Committed: Tue Sep 30 12:04:02 2014 +0200 ---------------------------------------------------------------------- lib/cpp/test/concurrency/ThreadFactoryTests.h | 12 +++++------- lib/cpp/test/concurrency/ThreadManagerTests.h | 15 ++++----------- lib/cpp/test/concurrency/TimerManagerTests.h | 15 ++++----------- 3 files changed, 13 insertions(+), 29 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/thrift/blob/293a40e9/lib/cpp/test/concurrency/ThreadFactoryTests.h ---------------------------------------------------------------------- diff --git a/lib/cpp/test/concurrency/ThreadFactoryTests.h b/lib/cpp/test/concurrency/ThreadFactoryTests.h index fda6c9e..2d97337 100755 --- a/lib/cpp/test/concurrency/ThreadFactoryTests.h +++ b/lib/cpp/test/concurrency/ThreadFactoryTests.h @@ -24,7 +24,6 @@ #include <thrift/concurrency/Util.h> #include <assert.h> -#include <unistd.h> #include <iostream> #include <set> @@ -42,7 +41,7 @@ class ThreadFactoryTests { public: - static const double ERROR; + static const double TEST_TOLERANCE; class Task: public Runnable { @@ -279,7 +278,7 @@ public: error *= 1.0; } - bool success = error < ThreadFactoryTests::ERROR; + bool success = error < ThreadFactoryTests::TEST_TOLERANCE; std::cout << "\t\t\t" << (success ? "Success" : "Failure") << "! expected time: " << count * timeout << "ms elapsed time: "<< endTime - startTime << "ms error%: " << error * 100.0 << std::endl; @@ -302,7 +301,7 @@ public: std::cout << "\t\tthread " << _id << " started" << std::endl; } - usleep(1); + THRIFT_SLEEP_USEC(1); } const size_t _id; }; @@ -330,7 +329,7 @@ public: thread->start(); - usleep(1); + THRIFT_SLEEP_USEC(1); } catch (TException& e) { @@ -349,7 +348,6 @@ public: } }; -const double ThreadFactoryTests::ERROR = .20; +const double ThreadFactoryTests::TEST_TOLERANCE = .20; }}}} // apache::thrift::concurrency::test - http://git-wip-us.apache.org/repos/asf/thrift/blob/293a40e9/lib/cpp/test/concurrency/ThreadManagerTests.h ---------------------------------------------------------------------- diff --git a/lib/cpp/test/concurrency/ThreadManagerTests.h b/lib/cpp/test/concurrency/ThreadManagerTests.h index 4e53a2d..c08448b 100755 --- a/lib/cpp/test/concurrency/ThreadManagerTests.h +++ b/lib/cpp/test/concurrency/ThreadManagerTests.h @@ -33,17 +33,11 @@ namespace apache { namespace thrift { namespace concurrency { namespace test { using namespace apache::thrift::concurrency; -/** - * ThreadManagerTests class - * - * @version $Id:$ - */ class ThreadManagerTests { -public: - - static const double ERROR; + static const double TEST_TOLERANCE; +public: class Task: public Runnable { public: @@ -190,7 +184,7 @@ public: error*= -1.0; } - bool success = error < ERROR; + bool success = error < TEST_TOLERANCE; std::cout << "\t\t\t" << (success ? "Success" : "Failure") << "! expected time: " << expectedTime << "ms elapsed time: "<< time01 - time00 << "ms error%: " << error * 100.0 << std::endl; @@ -373,9 +367,8 @@ public: } }; -const double ThreadManagerTests::ERROR = .20; +const double ThreadManagerTests::TEST_TOLERANCE = .20; }}}} // apache::thrift::concurrency using namespace apache::thrift::concurrency::test; - http://git-wip-us.apache.org/repos/asf/thrift/blob/293a40e9/lib/cpp/test/concurrency/TimerManagerTests.h ---------------------------------------------------------------------- diff --git a/lib/cpp/test/concurrency/TimerManagerTests.h b/lib/cpp/test/concurrency/TimerManagerTests.h index 4fe9667..62eb4f4 100644 --- a/lib/cpp/test/concurrency/TimerManagerTests.h +++ b/lib/cpp/test/concurrency/TimerManagerTests.h @@ -29,17 +29,11 @@ namespace apache { namespace thrift { namespace concurrency { namespace test { using namespace apache::thrift::concurrency; -/** - * ThreadManagerTests class - * - * @version $Id:$ - */ class TimerManagerTests { - public: - - static const double ERROR; + static const double TEST_TOLERANCE; + public: class Task: public Runnable { public: @@ -65,7 +59,7 @@ class TimerManagerTests { float error = delta / _timeout; - if(error < ERROR) { + if(error < TEST_TOLERANCE) { _success = true; } @@ -149,7 +143,6 @@ class TimerManagerTests { Monitor _monitor; }; -const double TimerManagerTests::ERROR = .20; +const double TimerManagerTests::TEST_TOLERANCE = .20; }}}} // apache::thrift::concurrency -
