summaryrefslogtreecommitdiff
path: root/Userland/Tests
diff options
context:
space:
mode:
authorMițca Dumitru <dumitru0mitca@gmail.com>2021-03-15 17:27:13 +0200
committerAndreas Kling <kling@serenityos.org>2021-03-15 22:02:38 +0100
commit01a49dda85c6f6e14f65cf9bab03f896d74755ed (patch)
treef3265fe2dd3291b6c7e6df7ff35aaf245ef179ee /Userland/Tests
parent987cc904c21729046312cc49bf5b90de651bc3aa (diff)
downloadserenity-01a49dda85c6f6e14f65cf9bab03f896d74755ed.zip
LibM: Implement fmin/fmax
Diffstat (limited to 'Userland/Tests')
-rw-r--r--Userland/Tests/LibM/test-math.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/Userland/Tests/LibM/test-math.cpp b/Userland/Tests/LibM/test-math.cpp
index b0a988ee18..10744e24f3 100644
--- a/Userland/Tests/LibM/test-math.cpp
+++ b/Userland/Tests/LibM/test-math.cpp
@@ -247,4 +247,19 @@ TEST_CASE(gamma)
EXPECT_EQ(signgam, -1);
}
+TEST_CASE(fmax_and_fmin)
+{
+ EXPECT(fmax(-INFINITY, 0) == 0);
+ EXPECT(fmax(NAN, 12) == 12);
+ EXPECT(fmax(5, NAN) == 5);
+ EXPECT(isnan(fmax(NAN, NAN)));
+ EXPECT(isinf(fmax(1'000'000, INFINITY)));
+
+ EXPECT(isinf(fmin(-INFINITY, 0)));
+ EXPECT(fmin(0, INFINITY) == 0);
+ EXPECT(fmin(NAN, 5) == 5);
+ EXPECT(fmin(0, NAN) == 0);
+ EXPECT(isnan(fmin(NAN, NAN)));
+}
+
TEST_MAIN(Math)