-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathunix_system_test.cpp
42 lines (32 loc) · 999 Bytes
/
unix_system_test.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#include "unix_system.h"
#include <doctest/doctest.h>
namespace pivid {
TEST_CASE("parse_realtime") {
CHECK(
parse_realtime("2022-04-12T17:06:03,086814454-07:00") ==
doctest::Approx(1649808363.086814454)
);
CHECK(
parse_realtime("2022-04-13T08:06:03.086814454+08:00") ==
doctest::Approx(1649808363.086814454)
);
CHECK(
parse_realtime("2022-04-13T00:06:03.086814454Z") ==
doctest::Approx(1649808363.086814454)
);
CHECK(
parse_realtime("2022-04-13T00:06:03.086814454") ==
doctest::Approx(1649808363.086814454)
);
CHECK(parse_realtime("2022-04-13T00:06:03z") == 1649808363);
CHECK(parse_realtime("2022-04-13 00:06:03") == 1649808363);
}
TEST_CASE("format_realtime") {
CHECK(
format_realtime(1649808363.086814454) == "2022-04-13 00:06:03.087Z"
);
}
TEST_CASE("abbrev_realtime") {
CHECK(abbrev_realtime(1649808363.086814454) == "00:06:03.087Z");
}
} // namespace pivid