From 3d7a251a6b8b2e5dce3185fb78b8d89792add9a3 Mon Sep 17 00:00:00 2001 From: Gary Talent Date: Thu, 10 Feb 2022 02:00:59 -0600 Subject: [PATCH] [ox/std] Add min and max tests (synced from 0d368b3c02a6cf0ca6a889718ca4d56752a79594) --- src/ox/std/CMakeLists.txt | 1 + src/ox/std/math.cpp | 23 +++++++++++++++++++++++ 2 files changed, 24 insertions(+) create mode 100644 src/ox/std/math.cpp diff --git a/src/ox/std/CMakeLists.txt b/src/ox/std/CMakeLists.txt index e062f434d..c4546fd01 100644 --- a/src/ox/std/CMakeLists.txt +++ b/src/ox/std/CMakeLists.txt @@ -26,6 +26,7 @@ add_library( byteswap.cpp fmt.cpp heapmgr.cpp + math.cpp memops.cpp random.cpp substitutes.cpp diff --git a/src/ox/std/math.cpp b/src/ox/std/math.cpp new file mode 100644 index 000000000..ca4d2bbb8 --- /dev/null +++ b/src/ox/std/math.cpp @@ -0,0 +1,23 @@ +/* + * Copyright 2015 - 2022 gary@drinkingtea.net + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#include "math.hpp" + +namespace ox { + +static_assert(min(2, 1) == 1); +static_assert(min(1, 2) == 1); + +static_assert(max(2, 1) == 2); +static_assert(max(1, 2) == 2); + +static_assert(clamp(2, 1, 3) == 2); +static_assert(clamp(1, 2, 3) == 2); +static_assert(clamp(3, 1, 2) == 2); + +}