mirror of
https://github.com/krgamestudios/Toy.git
synced 2026-04-15 23:04:08 +10:00
Adjusted the layout of nativeClamp() and nativeLerp(), thanks Add00!
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user