CryptoByLeo/Src/RSPParser/Test.mq5

61 lines
2.1 KiB
MQL5
Raw Permalink Normal View History

2026-08-24 22:07:20 -05:00
//+------------------------------------------------------------------+
//| Test.mq5 |
//| Copyright 2026, Niquel Mendoza |
//| https://www.mql5.com |
//+------------------------------------------------------------------+
#property copyright "Copyright 2026, Niquel Mendoza"
#property link "https://www.mql5.com"
#property version "1.00"
#property strict
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
#include "Iteradores.mqh"
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
#resource "SHA3_512ShortMsg.rsp" as const string g_raw
//+------------------------------------------------------------------+
//| Script program start function |
//+------------------------------------------------------------------+
void OnStart()
2026-08-24 22:33:45 -05:00
{
2026-08-24 22:07:20 -05:00
//---
2026-08-24 22:33:45 -05:00
TSN::CRSPParser rsp;
//---
rsp.Assing(g_raw);
rsp.CorrectPadding();
rsp.Parse();
TSN::CRSPNode node = rsp.GetRoot();
2026-08-24 22:42:17 -05:00
//-- general
rsp.PrintCintaTypes(0, 10);
2026-08-24 22:33:45 -05:00
Print(node.RootSize());
2026-08-24 22:42:17 -05:00
TSN::CRSPNode lv = node["L"].Value();
PrintFormat("L value = %s | L Is cor meta = %s ", lv.ToString(), (node["L"].MetaIsCor() ? "true" : "false"));
2026-08-24 22:33:45 -05:00
Print(node["MD"].Value().ToString());
2026-08-24 22:42:17 -05:00
//---
2026-08-25 08:02:51 -05:00
node.MoveNextPositionsThis(3); // siguiente triplete
2026-08-24 22:42:17 -05:00
2026-08-25 08:02:51 -05:00
//---
const string keys[3] = {"Len", "Msg", "MD"};
Print("--------- iteration ---------");
CRSPIteratorHashFast(3) it = node.MakeHashIterator<RSPNODE_NH(3), TSN::CGenericHash_string>(keys);
while(it.IsValid() && it.ReadPars() < 10)
{
Print("Len:\n", it["Len"].Value().ToString());
Print("Msg:\n", it["Msg"].Value().ToString());
Print("MD:\n", it["MD"].Value().ToString());
it.Next();
}
2026-08-24 22:33:45 -05:00
}
2026-08-24 22:07:20 -05:00
//+------------------------------------------------------------------+