aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tests/CommonLibs/TimevalTest.cpp21
-rw-r--r--tests/CommonLibs/TimevalTest.ok23
-rw-r--r--tests/testsuite.at10
3 files changed, 23 insertions, 31 deletions
diff --git a/tests/CommonLibs/TimevalTest.cpp b/tests/CommonLibs/TimevalTest.cpp
index b4746f2..f579878 100644
--- a/tests/CommonLibs/TimevalTest.cpp
+++ b/tests/CommonLibs/TimevalTest.cpp
@@ -28,18 +28,31 @@
#include "Timeval.h"
#include <iostream>
+#include <assert.h>
using namespace std;
int main(int argc, char *argv[])
{
-
Timeval then(10000);
- cout << then.elapsed() << endl;
+ assert(then.elapsed() == -10000);
+ cerr << then << " elapsed: " << then.elapsed() << endl;
+ double then_seconds = then.seconds();
+ double last_now = Timeval().seconds();
+ long last_remaining = 10000;
+ int loops = 0;
while (!then.passed()) {
- cout << "now: " << Timeval() << " then: " << then << " remaining: " << then.remaining() << endl;
+ double tnow = Timeval().seconds();
+ cerr << "now: " << tnow << " then: " << then << " remaining: " << then.remaining() << endl;
+ assert(last_now <= tnow && last_remaining >= then.remaining());
+ assert(then_seconds == then.seconds());
usleep(500000);
+ loops++;
}
- cout << "now: " << Timeval() << " then: " << then << " remaining: " << then.remaining() << endl;
+ cerr << "now: " << Timeval() << " then: " << then << " remaining: " << then.remaining() << endl;
+ assert(then.remaining() <= 0);
+ assert(loops >= 18);
+
+ printf("Done\n");
}
diff --git a/tests/CommonLibs/TimevalTest.ok b/tests/CommonLibs/TimevalTest.ok
index c97031d..a965a70 100644
--- a/tests/CommonLibs/TimevalTest.ok
+++ b/tests/CommonLibs/TimevalTest.ok
@@ -1,22 +1 @@
--10000
-now: 1515515602.357742 then: 1515515612.357710 remaining: 10000
-now: 1515515602.857837 then: 1515515612.357710 remaining: 9500
-now: 1515515603.357975 then: 1515515612.357710 remaining: 9000
-now: 1515515603.858163 then: 1515515612.357710 remaining: 8500
-now: 1515515604.358353 then: 1515515612.357710 remaining: 8000
-now: 1515515604.858465 then: 1515515612.357710 remaining: 7500
-now: 1515515605.358622 then: 1515515612.357710 remaining: 7000
-now: 1515515605.858745 then: 1515515612.357710 remaining: 6499
-now: 1515515606.358852 then: 1515515612.357710 remaining: 5999
-now: 1515515606.859055 then: 1515515612.357710 remaining: 5499
-now: 1515515607.359170 then: 1515515612.357710 remaining: 4999
-now: 1515515607.859349 then: 1515515612.357710 remaining: 4499
-now: 1515515608.359455 then: 1515515612.357710 remaining: 3999
-now: 1515515608.859549 then: 1515515612.357710 remaining: 3499
-now: 1515515609.359748 then: 1515515612.357710 remaining: 2998
-now: 1515515609.859865 then: 1515515612.357710 remaining: 2498
-now: 1515515610.360064 then: 1515515612.357710 remaining: 1998
-now: 1515515610.860223 then: 1515515612.357710 remaining: 1498
-now: 1515515611.360386 then: 1515515612.357710 remaining: 998
-now: 1515515611.860592 then: 1515515612.357710 remaining: 498
-now: 1515515612.360712 then: 1515515612.357710 remaining: -3
+Done
diff --git a/tests/testsuite.at b/tests/testsuite.at
index 5d519d2..8e9a541 100644
--- a/tests/testsuite.at
+++ b/tests/testsuite.at
@@ -32,11 +32,11 @@ AT_CLEANUP
#AT_CHECK([$abs_top_builddir/tests/CommonLibs/SocketsTest], [], [expout], [])
#AT_CLEANUP
-#AT_SETUP([TimevalTest])
-#AT_KEYWORDS([TimevalTest])
-#cat $abs_srcdir/CommonLibs/TimevalTest.ok > expout
-#AT_CHECK([$abs_top_builddir/tests/CommonLibs/TimevalTest], [], [expout], [])
-#AT_CLEANUP
+AT_SETUP([TimevalTest])
+AT_KEYWORDS([TimevalTest])
+cat $abs_srcdir/CommonLibs/TimevalTest.ok > expout
+AT_CHECK([$abs_top_builddir/tests/CommonLibs/TimevalTest], [], [expout], [ignore])
+AT_CLEANUP
AT_SETUP([VectorTest])
AT_KEYWORDS([VectorTest])