1
0
mirror of https://github.com/falk-werner/webfuse-provider synced 2024-10-27 20:44:10 +00:00
falk-werner_webfuse-provider/test/test_timepoint.cc
Falk Werner 1c9d1c8420
feat(API wrapper): separates implementation from public API
* moves implementation to impl subdirectory
* adds prefix _impl to implementation symbols
* removes double compilation for shared and static libraries
* fixes include guards
* fixes usage of extern "C"
2019-03-26 15:35:33 +01:00

37 lines
819 B
C++

#include <gtest/gtest.h>
#include "msleep.hpp"
#include "wsfs/adapter/impl/time/timepoint.h"
using wsfs_test::msleep;
TEST(timepoint, now)
{
wsfs_impl_timepoint start = wsfs_impl_timepoint_now();
msleep(42);
wsfs_impl_timepoint end = wsfs_impl_timepoint_now();
ASSERT_LT(start, end);
ASSERT_LT(end, start + 500);
}
TEST(timepoint, in_msec)
{
wsfs_impl_timepoint now = wsfs_impl_timepoint_now();
wsfs_impl_timepoint later = wsfs_impl_timepoint_in_msec(42);
ASSERT_LT(now, later);
ASSERT_LT(later, now + 500);
}
TEST(wsfs_impl_timepoint, elapsed)
{
wsfs_impl_timepoint now;
now = wsfs_impl_timepoint_now();
ASSERT_TRUE(wsfs_impl_timepoint_is_elapsed(now - 1));
now =wsfs_impl_timepoint_now();
ASSERT_FALSE(wsfs_impl_timepoint_is_elapsed(now + 500));
}