Blender V4.3
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
10
16
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);
22}
23
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);
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);
33}
34
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);
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);
44}
45
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
EXPECT_EQ(BLI_expr_pylike_eval(expr, nullptr, 0, &result), EXPR_PYLIKE_INVALID)
#define CCL_NAMESPACE_END
double time_human_readable_to_seconds(const string &time_string)
Definition time.cpp:82
string time_human_readable_from_seconds(const double seconds)
Definition time.cpp:67
CCL_NAMESPACE_BEGIN TEST(time_human_readable_to_seconds, Empty)