Coverage Report

Created: 2025-11-02 07:25

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/serenity/Userland/Libraries/LibLocale/RelativeTimeFormat.cpp
Line
Count
Source
1
/*
2
 * Copyright (c) 2022-2023, Tim Flynn <trflynn89@serenityos.org>
3
 *
4
 * SPDX-License-Identifier: BSD-2-Clause
5
 */
6
7
#include <LibLocale/RelativeTimeFormat.h>
8
9
namespace Locale {
10
11
Optional<TimeUnit> time_unit_from_string(StringView time_unit)
12
0
{
13
0
    if (time_unit == "second"sv)
14
0
        return TimeUnit::Second;
15
0
    if (time_unit == "minute"sv)
16
0
        return TimeUnit::Minute;
17
0
    if (time_unit == "hour"sv)
18
0
        return TimeUnit::Hour;
19
0
    if (time_unit == "day"sv)
20
0
        return TimeUnit::Day;
21
0
    if (time_unit == "week"sv)
22
0
        return TimeUnit::Week;
23
0
    if (time_unit == "month"sv)
24
0
        return TimeUnit::Month;
25
0
    if (time_unit == "quarter"sv)
26
0
        return TimeUnit::Quarter;
27
0
    if (time_unit == "year"sv)
28
0
        return TimeUnit::Year;
29
0
    return {};
30
0
}
31
32
StringView time_unit_to_string(TimeUnit time_unit)
33
0
{
34
0
    switch (time_unit) {
35
0
    case TimeUnit::Second:
36
0
        return "second"sv;
37
0
    case TimeUnit::Minute:
38
0
        return "minute"sv;
39
0
    case TimeUnit::Hour:
40
0
        return "hour"sv;
41
0
    case TimeUnit::Day:
42
0
        return "day"sv;
43
0
    case TimeUnit::Week:
44
0
        return "week"sv;
45
0
    case TimeUnit::Month:
46
0
        return "month"sv;
47
0
    case TimeUnit::Quarter:
48
0
        return "quarter"sv;
49
0
    case TimeUnit::Year:
50
0
        return "year"sv;
51
0
    default:
52
0
        VERIFY_NOT_REACHED();
53
0
    }
54
0
}
55
56
Vector<RelativeTimeFormat> __attribute__((weak)) get_relative_time_format_patterns(StringView, TimeUnit, StringView, Style) { return {}; }
57
58
}