mirror of
https://github.com/nextcloud/desktop.git
synced 2024-11-26 06:55:59 +03:00
Add test with 3 and 5 seconds.
This commit is contained in:
parent
5a77997d55
commit
891827a48a
1 changed files with 34 additions and 1 deletions
|
@ -1,4 +1,5 @@
|
|||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "support.h"
|
||||
|
||||
|
@ -18,6 +19,21 @@ START_TEST (check_c_tspecdiff)
|
|||
}
|
||||
END_TEST
|
||||
|
||||
START_TEST (check_c_tspecdiff_five)
|
||||
{
|
||||
struct timespec start, finish, diff;
|
||||
|
||||
clock_gettime(CLOCK_REALTIME, &start);
|
||||
sleep(5);
|
||||
clock_gettime(CLOCK_REALTIME, &finish);
|
||||
|
||||
diff = c_tspecdiff(finish, start);
|
||||
|
||||
fail_unless(diff.tv_sec == 5, NULL);
|
||||
fail_unless(diff.tv_nsec > 0, NULL);
|
||||
}
|
||||
END_TEST
|
||||
|
||||
START_TEST (check_c_secdiff)
|
||||
{
|
||||
struct timespec start, finish;
|
||||
|
@ -28,7 +44,22 @@ START_TEST (check_c_secdiff)
|
|||
|
||||
diff = c_secdiff(finish, start);
|
||||
|
||||
fail_unless(diff > 0.00 && diff < 1.00, NULL);
|
||||
fail_unless(diff > 0.00 && diff < 1.00, "diff is %.2f", diff);
|
||||
}
|
||||
END_TEST
|
||||
|
||||
START_TEST (check_c_secdiff_three)
|
||||
{
|
||||
struct timespec start, finish;
|
||||
double diff;
|
||||
|
||||
clock_gettime(CLOCK_REALTIME, &start);
|
||||
sleep(3);
|
||||
clock_gettime(CLOCK_REALTIME, &finish);
|
||||
|
||||
diff = c_secdiff(finish, start);
|
||||
|
||||
fail_unless(diff > 3.00 && diff < 4.00, "diff is %.2f", diff);
|
||||
}
|
||||
END_TEST
|
||||
|
||||
|
@ -36,7 +67,9 @@ static Suite *make_std_c_suite(void) {
|
|||
Suite *s = suite_create("std:path:c_basename");
|
||||
|
||||
create_case(s, "check_c_tspecdiff", check_c_tspecdiff);
|
||||
create_case(s, "check_c_tspecdiff_five", check_c_tspecdiff_five);
|
||||
create_case(s, "check_c_secdiff", check_c_secdiff);
|
||||
create_case(s, "check_c_secdiff_three", check_c_secdiff_three);
|
||||
|
||||
return s;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue