Add background thread related stats.
This commit is contained in:
@@ -85,6 +85,23 @@ TEST_BEGIN(test_nstime_add) {
|
||||
}
|
||||
TEST_END
|
||||
|
||||
TEST_BEGIN(test_nstime_iadd) {
|
||||
nstime_t nsta, nstb;
|
||||
|
||||
nstime_init2(&nsta, 42, BILLION - 1);
|
||||
nstime_iadd(&nsta, 1);
|
||||
nstime_init2(&nstb, 43, 0);
|
||||
assert_d_eq(nstime_compare(&nsta, &nstb), 0,
|
||||
"Incorrect addition result");
|
||||
|
||||
nstime_init2(&nsta, 42, 1);
|
||||
nstime_iadd(&nsta, BILLION + 1);
|
||||
nstime_init2(&nstb, 43, 2);
|
||||
assert_d_eq(nstime_compare(&nsta, &nstb), 0,
|
||||
"Incorrect addition result");
|
||||
}
|
||||
TEST_END
|
||||
|
||||
TEST_BEGIN(test_nstime_subtract) {
|
||||
nstime_t nsta, nstb;
|
||||
|
||||
@@ -104,6 +121,23 @@ TEST_BEGIN(test_nstime_subtract) {
|
||||
}
|
||||
TEST_END
|
||||
|
||||
TEST_BEGIN(test_nstime_isubtract) {
|
||||
nstime_t nsta, nstb;
|
||||
|
||||
nstime_init2(&nsta, 42, 43);
|
||||
nstime_isubtract(&nsta, 42*BILLION + 43);
|
||||
nstime_init(&nstb, 0);
|
||||
assert_d_eq(nstime_compare(&nsta, &nstb), 0,
|
||||
"Incorrect subtraction result");
|
||||
|
||||
nstime_init2(&nsta, 42, 43);
|
||||
nstime_isubtract(&nsta, 41*BILLION + 44);
|
||||
nstime_init2(&nstb, 0, BILLION - 1);
|
||||
assert_d_eq(nstime_compare(&nsta, &nstb), 0,
|
||||
"Incorrect subtraction result");
|
||||
}
|
||||
TEST_END
|
||||
|
||||
TEST_BEGIN(test_nstime_imultiply) {
|
||||
nstime_t nsta, nstb;
|
||||
|
||||
@@ -204,7 +238,9 @@ main(void) {
|
||||
test_nstime_copy,
|
||||
test_nstime_compare,
|
||||
test_nstime_add,
|
||||
test_nstime_iadd,
|
||||
test_nstime_subtract,
|
||||
test_nstime_isubtract,
|
||||
test_nstime_imultiply,
|
||||
test_nstime_idivide,
|
||||
test_nstime_divide,
|
||||
|
Reference in New Issue
Block a user