Adjusted the layout of nativeClamp() and nativeLerp(), thanks Add00!

This commit is contained in:
2023-07-31 04:25:08 +10:00
parent 6ba42b5a9b
commit 0cef0abdb5
2 changed files with 105 additions and 69 deletions

View File

@@ -133,6 +133,31 @@ import standard;
}
//test clamp
{
assert clamp(1, 0, 5) == 1, "clamp(1, 0, 5) failed";
assert clamp(0, 1, 5) == 1, "clamp(0, 1, 5) failed";
assert clamp(10, 1, 5) == 5, "clamp(10, 1, 5) failed";
assert clamp(1.0, 0.0, 5.0) == 1, "clamp(1.0, 0.0, 5.0) failed";
assert clamp(0.0, 1.0, 5.0) == 1, "clamp(0.0, 1.0, 5.0) failed";
assert clamp(10.0, 1.0, 5.0) == 5, "clamp(10.0, 1.0, 5.0) failed";
assert typeof clamp(10, 1, 5) == int, "typeof clamp(10, 1, 5) == int failed";
assert typeof clamp(10.0, 1, 5) == int, "typeof clamp(10.0, 1, 5) == int failed";
assert typeof clamp(10, 1, 5.0) == float, "typeof clamp(10, 1, 5.0) == float failed";
}
//test lerp
{
assert lerp(0, 10, 0.5) == 5, "lerp 50% failed";
assert lerp(0, 10, 1.5) == 15, "lerp 150% failed";
assert typeof lerp(0, 10, 0) == float, "typeof lerp result failed";
}
//test concat
{
//test array concat