summaryrefslogtreecommitdiff
path: root/cpp/test/IceUtil/thread/SleepTest.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/test/IceUtil/thread/SleepTest.cpp')
-rw-r--r--cpp/test/IceUtil/thread/SleepTest.cpp49
1 files changed, 49 insertions, 0 deletions
diff --git a/cpp/test/IceUtil/thread/SleepTest.cpp b/cpp/test/IceUtil/thread/SleepTest.cpp
new file mode 100644
index 00000000000..1c6b57b3df7
--- /dev/null
+++ b/cpp/test/IceUtil/thread/SleepTest.cpp
@@ -0,0 +1,49 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2015 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+#include <IceUtil/IceUtil.h>
+
+#include <stdio.h>
+
+#include <SleepTest.h>
+#include <TestCommon.h>
+
+using namespace std;
+using namespace IceUtil;
+
+static const string createTestName("thread sleep");
+
+SleepTest::SleepTest() :
+ TestBase(createTestName)
+{
+}
+
+void
+SleepTest::run()
+{
+ try
+ {
+ IceUtil::ThreadControl::sleep(IceUtil::Time::secondsDouble(-1));
+ test(false);
+ }
+ catch(const InvalidTimeoutException&)
+ {
+ }
+
+#ifdef _WIN32
+ try
+ {
+ IceUtil::ThreadControl::sleep(IceUtil::Time::secondsDouble(INFINITE));
+ test(false);
+ }
+ catch(const InvalidTimeoutException&)
+ {
+ }
+#endif
+}