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