mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-09-07 10:34:54 -06:00
.autotest
git-svn-id: svn://ultimatepp.org/upp/trunk@10475 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
5bfce38044
commit
2b49ff8faf
1 changed files with 22 additions and 7 deletions
|
|
@ -2,13 +2,28 @@
|
|||
|
||||
using namespace Upp;
|
||||
|
||||
bool FltMatch(double x, double y)
|
||||
{
|
||||
return abs(x - y) < min(abs(x), abs(y)) / 1e5;
|
||||
}
|
||||
|
||||
bool DblMatch(double x, double y)
|
||||
{
|
||||
return abs(x - y) < min(abs(x), abs(y)) / 1e10;
|
||||
}
|
||||
|
||||
CONSOLE_APP_MAIN
|
||||
{
|
||||
ASSERT(abs(-1) == 1);
|
||||
ASSERT(abs((int16)-1) == 1);
|
||||
ASSERT(abs((int64)-1) == 1);
|
||||
ASSERT(abs((int8)-1) == 1);
|
||||
ASSERT(abs((float)-1) == 1);
|
||||
ASSERT(abs((double)-1) == 1);
|
||||
LOG("OK");
|
||||
StdLogSetup(LOG_COUT|LOG_FILE);
|
||||
|
||||
ASSERT(abs(-0x40000000) == 0x40000000);
|
||||
ASSERT(abs((int16)-0x4000) == 0x4000);
|
||||
ASSERT(abs((int64)-0x400000000000) == 0x400000000000);
|
||||
ASSERT(abs((int8)-0x40) == 0x40);
|
||||
ASSERT(FltMatch(abs((float)-1.1), 1.1));
|
||||
ASSERT(DblMatch(abs((double)-1.1), 1.1));
|
||||
|
||||
ASSERT(abs(Complex(3, -4)) == 5);
|
||||
|
||||
LOG("=============== OK");
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue