mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 10:27:36 +00:00
AK: Cover TestComplex with more tests
Related: - video detailing the process of writing these tests: https://www.youtube.com/watch?v=enxglLlALvI - PR fixing bugs the above effort found: https://github.com/SerenityOS/serenity/pull/22025
This commit is contained in:
parent
d52ffcd830
commit
5a8781393a
2 changed files with 199 additions and 0 deletions
|
@ -277,6 +277,14 @@ static constexpr Complex<T> cexp(Complex<T> const& a)
|
|||
}
|
||||
}
|
||||
|
||||
template<AK::Concepts::Arithmetic T>
|
||||
struct AK::Formatter<AK::Complex<T>> : Formatter<StringView> {
|
||||
ErrorOr<void> format(FormatBuilder& builder, AK::Complex<T> c)
|
||||
{
|
||||
return Formatter<StringView>::format(builder, TRY(String::formatted("{}{:+}i", c.real(), c.imag())));
|
||||
}
|
||||
};
|
||||
|
||||
#if USING_AK_GLOBALLY
|
||||
using AK::approx_eq;
|
||||
using AK::cexp;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue