81 lines
4.1 KiB
MQL5
81 lines
4.1 KiB
MQL5
//+------------------------------------------------------------------+
|
|
//| TestClasses.mq5 |
|
|
//| Copyright 2003-2022 Sergey Bochkanov (ALGLIB project) |
|
|
//| Copyright 2012-2023, MetaQuotes Ltd. |
|
|
//| https://www.mql5.com |
|
|
//+------------------------------------------------------------------+
|
|
//| Implementation of ALGLIB library in MetaQuotes Language 5 |
|
|
//| |
|
|
//| The features of the library include: |
|
|
//| - Linear algebra (direct algorithms, EVD, SVD) |
|
|
//| - Solving systems of linear and non-linear equations |
|
|
//| - Interpolation |
|
|
//| - Optimization |
|
|
//| - FFT (Fast Fourier Transform) |
|
|
//| - Numerical integration |
|
|
//| - Linear and nonlinear least-squares fitting |
|
|
//| - Ordinary differential equations |
|
|
//| - Computation of special functions |
|
|
//| - Descriptive statistics and hypothesis testing |
|
|
//| - Data analysis - classification, regression |
|
|
//| - Implementing linear algebra algorithms, interpolation, etc. |
|
|
//| in high-precision arithmetic (using MPFR) |
|
|
//| |
|
|
//| This file is free software; you can redistribute it and/or |
|
|
//| modify it under the terms of the GNU General Public License as |
|
|
//| published by the Free Software Foundation (www.fsf.org); either |
|
|
//| version 2 of the License, or (at your option) any later version. |
|
|
//| |
|
|
//| This program is distributed in the hope that it will be useful, |
|
|
//| but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
|
//| MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
|
//| GNU General Public License for more details. |
|
|
//+------------------------------------------------------------------+
|
|
#define PrintElapsed(function,check,elapsed) PrintFormat("%-40s: %10s in %14s",function,(check ? "PASSED " : "- FAILED -"),elapsed);
|
|
|
|
#include "TestClasses.mqh"
|
|
|
|
input bool InpSilent=true;
|
|
input uint InpSeed=494513281;
|
|
//+------------------------------------------------------------------+
|
|
//| Testing script |
|
|
//+------------------------------------------------------------------+
|
|
void OnStart()
|
|
{
|
|
bool check;
|
|
ulong start_mcs;
|
|
ulong stop_mcs;
|
|
//--- initialization
|
|
bool silent=InpSilent;
|
|
uint seed=GetTickCount();
|
|
if(InpSeed!=UINT_MAX)
|
|
seed=InpSeed;
|
|
//--- seed
|
|
PrintFormat("RandomSeed = %u",seed);
|
|
|
|
//--- check class CHighQualityRand // 1
|
|
_RandomSeed=seed;
|
|
start_mcs=GetMicrosecondCount();
|
|
check=CTestHQRndUnit::TestHQRnd(silent);
|
|
stop_mcs=GetMicrosecondCount();
|
|
PrintElapsed("CHighQualityRand",check,GetElapsed(stop_mcs-start_mcs));
|
|
|
|
//--- check class CRBF // 87
|
|
_RandomSeed=seed;
|
|
start_mcs=GetMicrosecondCount();
|
|
check=CTestRBFUnit::TestRBF(silent);
|
|
stop_mcs=GetMicrosecondCount();
|
|
PrintElapsed("CRBF",check,GetElapsed(stop_mcs-start_mcs));
|
|
}
|
|
//+------------------------------------------------------------------+
|
|
//| |
|
|
//+------------------------------------------------------------------+
|
|
string GetElapsed(ulong microseconds)
|
|
{
|
|
int sec=int(microseconds/1000000);
|
|
int mcs=int(microseconds%1000000);
|
|
string elapsed=StringFormat("%d.%06d sec",sec,mcs);
|
|
|
|
return(elapsed);
|
|
}
|
|
//+------------------------------------------------------------------+
|