summaryrefslogtreecommitdiff
path: root/dbtests/basictests.cpp
diff options
context:
space:
mode:
authorEliot Horowitz <eliot@10gen.com>2010-04-27 14:18:56 -0400
committerEliot Horowitz <eliot@10gen.com>2010-04-27 14:18:56 -0400
commitb2b69c229b22700f4ccbe9e4f5b64fbe9cbb4f4d (patch)
tree2e82922cb3dd4c9e2e8b992bf201fc7c243ab342 /dbtests/basictests.cpp
parentef6b1e355e3bae485b62475699d82671e699638e (diff)
downloadmongo-b2b69c229b22700f4ccbe9e4f5b64fbe9cbb4f4d.tar.gz
tests for sleepmicros
Diffstat (limited to 'dbtests/basictests.cpp')
-rw-r--r--dbtests/basictests.cpp44
1 files changed, 33 insertions, 11 deletions
diff --git a/dbtests/basictests.cpp b/dbtests/basictests.cpp
index 996077c6c38..85e04bb48aa 100644
--- a/dbtests/basictests.cpp
+++ b/dbtests/basictests.cpp
@@ -201,21 +201,43 @@ namespace BasicTests {
sleepmillis( 1727 );
ASSERT( t.millis() >= 1000 );
ASSERT( t.millis() <= 2000 );
-
- int total = 1200;
- int ms = 2;
- t.reset();
- for ( int i=0; i<(total/ms); i++ ){
- sleepmillis( ms );
+
+ {
+ int total = 1200;
+ int ms = 2;
+ t.reset();
+ for ( int i=0; i<(total/ms); i++ ){
+ sleepmillis( ms );
+ }
+ {
+ int x = t.millis();
+ if ( x < 1000 || x > 2500 ){
+ cout << "sleeptest x: " << x << endl;
+ ASSERT( x >= 1000 );
+ ASSERT( x <= 20000 );
+ }
+ }
}
+
+
{
- int x = t.millis();
- if ( x < 1000 || x > 2500 ){
- cout << "sleeptest x: " << x << endl;
- ASSERT( x >= 1000 );
- ASSERT( x <= 20000 );
+ int total = 1200;
+ int micros = 100;
+ t.reset();
+ int numSleeps = 1000*(total/micros);
+ for ( int i=0; i<numSleeps; i++ ){
+ sleepmicros( micros );
+ }
+ {
+ int x = t.millis();
+ if ( x < 1000 || x > 2500 ){
+ cout << "sleeptest x: " << x << endl;
+ ASSERT( x >= 1000 );
+ ASSERT( x <= 20000 );
+ }
}
}
+
}