Format all C++ and Java code via clang-format

Signed-off-by: Konstantin Pastbin <konstantin.pastbin@gmail.com>
This commit is contained in:
Konstantin Pastbin
2025-08-17 14:32:37 +07:00
parent 9f0290c0ec
commit bfffa1fff4
2169 changed files with 56441 additions and 64188 deletions

View File

@@ -19,24 +19,25 @@ struct TestData
std::string result;
Duration(long days, long hours, long minutes, long seconds, std::string const & result)
: m_days(days), m_hours(hours), m_minutes(minutes), m_seconds(seconds), result(result)
: m_days(days)
, m_hours(hours)
, m_minutes(minutes)
, m_seconds(seconds)
, result(result)
{}
long Seconds() const
{
return (duration_cast<seconds>(m_days) +
duration_cast<seconds>(m_hours) +
duration_cast<seconds>(m_minutes) +
m_seconds).count();
return (duration_cast<seconds>(m_days) + duration_cast<seconds>(m_hours) + duration_cast<seconds>(m_minutes) +
m_seconds)
.count();
}
};
Locale m_locale;
std::vector<Duration> m_duration;
constexpr TestData(Locale locale, std::vector<Duration> duration)
: m_locale(locale), m_duration(duration)
{}
constexpr TestData(Locale locale, std::vector<Duration> duration) : m_locale(locale), m_duration(duration) {}
};
Locale GetLocale(std::string const & language)
@@ -58,26 +59,23 @@ auto const d = Duration::GetUnitsString(Duration::Units::Days);
UNIT_TEST(Duration_AllUnits)
{
TestData const testData[] = {
{GetLocale("en"),
{
{0, 0, 0, 0, "0" + m},
{0, 0, 0, 30, "0" + m},
{0, 0, 0, 59, "0" + m},
{0, 0, 1, 0, "1" + m},
{0, 0, 1, 59, "1" + m},
{0, 0, 60, 0, "1" + h},
{0, 0, 123, 0, "2" + h + kNonBreakingSpace + "3" + m},
{0, 3, 0, 0, "3" + h},
{0, 24, 0, 0, "1" + d},
{4, 0, 0, 0, "4" + d},
{1, 2, 3, 0, "1" + d + kNonBreakingSpace + "2" + h + kNonBreakingSpace + "3" + m},
{1, 0, 15, 0, "1" + d + kNonBreakingSpace + "15" + m},
{0, 15, 1, 0, "15" + h + kNonBreakingSpace + "1" + m},
{1, 15, 0, 0, "1" + d + kNonBreakingSpace + "15" + h},
{15, 0, 10, 0, "15" + d + kNonBreakingSpace + "10" + m},
{15, 15, 15, 0, "15" + d + kNonBreakingSpace + "15" + h + kNonBreakingSpace + "15" + m}
}
},
{GetLocale("en"),
{{0, 0, 0, 0, "0" + m},
{0, 0, 0, 30, "0" + m},
{0, 0, 0, 59, "0" + m},
{0, 0, 1, 0, "1" + m},
{0, 0, 1, 59, "1" + m},
{0, 0, 60, 0, "1" + h},
{0, 0, 123, 0, "2" + h + kNonBreakingSpace + "3" + m},
{0, 3, 0, 0, "3" + h},
{0, 24, 0, 0, "1" + d},
{4, 0, 0, 0, "4" + d},
{1, 2, 3, 0, "1" + d + kNonBreakingSpace + "2" + h + kNonBreakingSpace + "3" + m},
{1, 0, 15, 0, "1" + d + kNonBreakingSpace + "15" + m},
{0, 15, 1, 0, "15" + h + kNonBreakingSpace + "1" + m},
{1, 15, 0, 0, "1" + d + kNonBreakingSpace + "15" + h},
{15, 0, 10, 0, "15" + d + kNonBreakingSpace + "10" + m},
{15, 15, 15, 0, "15" + d + kNonBreakingSpace + "15" + h + kNonBreakingSpace + "15" + m}}},
};
for (auto const & data : testData)
@@ -85,7 +83,8 @@ UNIT_TEST(Duration_AllUnits)
for (auto const & dataDuration : data.m_duration)
{
auto const duration = Duration(dataDuration.Seconds());
auto durationStr = duration.GetLocalizedString({Duration::Units::Days, Duration::Units::Hours, Duration::Units::Minutes}, data.m_locale);
auto durationStr = duration.GetLocalizedString(
{Duration::Units::Days, Duration::Units::Hours, Duration::Units::Minutes}, data.m_locale);
TEST_EQUAL(durationStr, dataDuration.result, ());
}
}
@@ -94,19 +93,24 @@ UNIT_TEST(Duration_AllUnits)
UNIT_TEST(Duration_Localization)
{
TestData const testData[] = {
// en
{GetLocale("en"), {{1, 2, 3, 0, "1" + d + kNonBreakingSpace + "2" + h + kNonBreakingSpace + "3" + m}}},
// ru (narrow spacing between number and unit)
{GetLocale("ru"), {{1, 2, 3, 0, "1" + kNarrowNonBreakingSpace + d + kNonBreakingSpace + "2" + kNarrowNonBreakingSpace + h + kNonBreakingSpace + "3" + kNarrowNonBreakingSpace + m}}},
// zh (no spacings)
{GetLocale("zh"), {{1, 2, 3, 0, "1" + d + "2" + h + "3" + m}}}
};
// en
{GetLocale("en"), {{1, 2, 3, 0, "1" + d + kNonBreakingSpace + "2" + h + kNonBreakingSpace + "3" + m}}},
// ru (narrow spacing between number and unit)
{GetLocale("ru"),
{{1, 2, 3, 0,
"1" + kNarrowNonBreakingSpace + d + kNonBreakingSpace + "2" + kNarrowNonBreakingSpace + h + kNonBreakingSpace +
"3" + kNarrowNonBreakingSpace + m}}},
// zh (no spacings)
{GetLocale("zh"), {{1, 2, 3, 0, "1" + d + "2" + h + "3" + m}}}};
for (auto const & data : testData)
{
for (auto const & duration : data.m_duration)
{
auto const durationStr = Duration(duration.Seconds()).GetLocalizedString({Duration::Units::Days, Duration::Units::Hours, Duration::Units::Minutes}, data.m_locale);
auto const durationStr =
Duration(duration.Seconds())
.GetLocalizedString({Duration::Units::Days, Duration::Units::Hours, Duration::Units::Minutes},
data.m_locale);
TEST_EQUAL(durationStr, duration.result, ());
}
}