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
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 @@
public:
- static const double ERROR;
+ static const double TEST_TOLERANCE;
class Task: public Runnable {
@@ -279,7 +278,7 @@
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 @@
std::cout << "\t\tthread " << _id << " started" << std::endl;
}
- usleep(1);
+ THRIFT_SLEEP_USEC(1);
}
const size_t _id;
};
@@ -330,7 +329,7 @@
thread->start();
- usleep(1);
+ THRIFT_SLEEP_USEC(1);
} catch (TException& e) {
@@ -349,7 +348,6 @@
}
};
-const double ThreadFactoryTests::ERROR = .20;
+const double ThreadFactoryTests::TEST_TOLERANCE = .20;
}}}} // apache::thrift::concurrency::test
-