Blender
V3.3
intern
cycles
test
util_time_test.cpp
Go to the documentation of this file.
1
/* SPDX-License-Identifier: Apache-2.0
2
* Copyright 2011-2022 Blender Foundation */
3
4
#include "testing/testing.h"
5
6
#include "
util/time.h
"
7
8
CCL_NAMESPACE_BEGIN
9
10
TEST
(
time_human_readable_to_seconds
, Empty)
11
{
12
EXPECT_EQ
(
time_human_readable_to_seconds
(
""
), 0.0);
13
EXPECT_EQ
(
time_human_readable_from_seconds
(0.0),
"00:00.00"
);
14
}
15
16
TEST
(
time_human_readable_to_seconds
, Fraction)
17
{
18
EXPECT_NEAR(
time_human_readable_to_seconds
(
".1"
), 0.1, 1e-8f);
19
EXPECT_NEAR(
time_human_readable_to_seconds
(
".10"
), 0.1, 1e-8f);
20
EXPECT_EQ
(
time_human_readable_from_seconds
(0.1),
"00:00.10"
);
21
}
22
23
TEST
(
time_human_readable_to_seconds
, Seconds)
24
{
25
EXPECT_NEAR(
time_human_readable_to_seconds
(
"2.1"
), 2.1, 1e-8f);
26
EXPECT_NEAR(
time_human_readable_to_seconds
(
"02.10"
), 2.1, 1e-8f);
27
EXPECT_EQ
(
time_human_readable_from_seconds
(2.1),
"00:02.10"
);
28
29
EXPECT_NEAR(
time_human_readable_to_seconds
(
"12.1"
), 12.1, 1e-8f);
30
EXPECT_NEAR(
time_human_readable_to_seconds
(
"12.10"
), 12.1, 1e-8f);
31
EXPECT_EQ
(
time_human_readable_from_seconds
(12.1),
"00:12.10"
);
32
}
33
34
TEST
(
time_human_readable_to_seconds
, MinutesSeconds)
35
{
36
EXPECT_NEAR(
time_human_readable_to_seconds
(
"3:2.1"
), 182.1, 1e-8f);
37
EXPECT_NEAR(
time_human_readable_to_seconds
(
"03:02.10"
), 182.1, 1e-8f);
38
EXPECT_EQ
(
time_human_readable_from_seconds
(182.1),
"03:02.10"
);
39
40
EXPECT_NEAR(
time_human_readable_to_seconds
(
"34:12.1"
), 2052.1, 1e-8f);
41
EXPECT_NEAR(
time_human_readable_to_seconds
(
"34:12.10"
), 2052.1, 1e-8f);
42
EXPECT_EQ
(
time_human_readable_from_seconds
(2052.1),
"34:12.10"
);
43
}
44
45
TEST
(
time_human_readable_to_seconds
, HoursMinutesSeconds)
46
{
47
EXPECT_NEAR(
time_human_readable_to_seconds
(
"4:3:2.1"
), 14582.1, 1e-8f);
48
EXPECT_NEAR(
time_human_readable_to_seconds
(
"04:03:02.10"
), 14582.1, 1e-8f);
49
EXPECT_EQ
(
time_human_readable_from_seconds
(14582.1),
"04:03:02.10"
);
50
51
EXPECT_NEAR(
time_human_readable_to_seconds
(
"56:34:12.1"
), 203652.1, 1e-8f);
52
EXPECT_NEAR(
time_human_readable_to_seconds
(
"56:34:12.10"
), 203652.1, 1e-8f);
53
EXPECT_EQ
(
time_human_readable_from_seconds
(203652.1),
"56:34:12.10"
);
54
}
55
56
CCL_NAMESPACE_END
EXPECT_EQ
EXPECT_EQ(BLI_expr_pylike_eval(expr, nullptr, 0, &result), EXPR_PYLIKE_INVALID)
CCL_NAMESPACE_END
#define CCL_NAMESPACE_END
Definition:
cuda/compat.h:9
CCL_NAMESPACE_BEGIN
Definition:
python.cpp:37
time_human_readable_to_seconds
double time_human_readable_to_seconds(const string &time_string)
Definition:
time.cpp:80
time_human_readable_from_seconds
string time_human_readable_from_seconds(const double seconds)
Definition:
time.cpp:65
time.h
TEST
CCL_NAMESPACE_BEGIN TEST(time_human_readable_to_seconds, Empty)
Definition:
util_time_test.cpp:10
Generated on Sat Jul 27 2024 14:57:55 for Blender by
doxygen
1.9.1