mirror of
https://github.com/krgamestudios/Toy.git
synced 2026-04-15 14:54:07 +10:00
Added math library
This commit is contained in:
27
test/scripts/lib/math.toy
Normal file
27
test/scripts/lib/math.toy
Normal file
@@ -0,0 +1,27 @@
|
||||
import math;
|
||||
|
||||
// test toRad
|
||||
{
|
||||
assert toRad(0) == 0, "toRad 0° failed";
|
||||
assert toRad(180) == PI, "toRad 180° failed";
|
||||
assert toRad(360) == 2 * PI, "toRad 360° failed";
|
||||
}
|
||||
|
||||
|
||||
// test toDeg
|
||||
{
|
||||
assert toDeg(0) == 0, "toDeg 0 failed";
|
||||
assert toDeg(PI) == 180, "toDeg π failed";
|
||||
assert toDeg(2 * PI) == 360, "toDeg 2π failed";
|
||||
}
|
||||
|
||||
// test sin
|
||||
{
|
||||
assert sin(PI) == 0, "sin π failed";
|
||||
}
|
||||
|
||||
|
||||
// test cos
|
||||
{
|
||||
assert cos(PI) == -1, "cos π failed";
|
||||
}
|
||||
@@ -158,32 +158,6 @@ import standard;
|
||||
}
|
||||
|
||||
|
||||
// test toRad
|
||||
{
|
||||
assert toRad(0) == 0, "toRad 0° failed";
|
||||
assert toRad(180) == PI, "toRad 180° failed";
|
||||
assert toRad(360) == 2 * PI, "toRad 360° failed";
|
||||
}
|
||||
|
||||
|
||||
// test toDeg
|
||||
{
|
||||
assert toDeg(0) == 0, "toDeg 0 failed";
|
||||
assert toDeg(PI) == 180, "toDeg π failed";
|
||||
assert toDeg(2 * PI) == 360, "toDeg 2π failed";
|
||||
}
|
||||
|
||||
// test sin
|
||||
{
|
||||
assert sin(PI) == 0, "sin π failed";
|
||||
}
|
||||
|
||||
|
||||
// test cos
|
||||
{
|
||||
assert cos(PI) == -1, "cos π failed";
|
||||
}
|
||||
|
||||
//test concat
|
||||
{
|
||||
//test array concat
|
||||
|
||||
Reference in New Issue
Block a user