ExpressEvalByLeo/Src/MathEval/Test.mq5
Nique_372 68d060365e
2026-05-14 16:54:23 -05:00

49 lines
1.6 KiB
MQL5

//+------------------------------------------------------------------+
//| Test.mq5 |
//| Copyright 2026, Niquel Mendoza. |
//| https://www.mql5.com/es/users/nique_372 |
//+------------------------------------------------------------------+
#property copyright "Copyright 2026, Niquel Mendoza."
#property link "https://www.mql5.com/es/users/nique_372"
#property version "1.00"
#property strict
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
#include "Tokenizer.mqh"
#include "StaticAst.mqh"
//+------------------------------------------------------------------+
//| Script program start function |
//+------------------------------------------------------------------+
void OnStart()
{
//---
CMathExpresionEvalStatic eval;
CMathExpTokenizer tokenizer;
TokenMathExp tokns[];
const string text = "10 * (50 + 20 * (20 + 20))";
BitInterpreter bit;
int type;
//---
//---
ulong a = GetMicrosecondCount();
for(int i = 0; i < 10000; i++)
{
if(!tokenizer.Tokenize(text, tokns))
{
Print(tokenizer.FormatLastError(text));
return;
}
eval.CleanCache(tokns);
eval.ParsNoRes(tokns, bit, type);
}
ulong d = GetMicrosecondCount() - a;
Print(d);
}
//+------------------------------------------------------------------+