1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

math: add fn clamp (#12205)

This commit is contained in:
czkz
2021-10-17 06:42:40 +03:00
committed by GitHub
parent fd3a10ab43
commit 29f068997b
2 changed files with 20 additions and 0 deletions

View File

@ -435,6 +435,14 @@ fn test_min() {
}
}
fn test_clamp() {
assert clamp(2, 5, 10) == 5
assert clamp(7, 5, 10) == 7
assert clamp(15, 5, 10) == 10
assert clamp(5, 5, 10) == 5
assert clamp(10, 5, 10) == 10
}
fn test_signi() {
assert signi(inf(-1)) == -1
assert signi(-72234878292.4586129) == -1