JsonParserByLeo/Test/Files.mq5

46 righe
1,7 KiB
MQL5

2026-06-18 10:50:55 -05:00
//+------------------------------------------------------------------+
//| Files.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 "..\\Src\\JsonNode.mqh"
//+------------------------------------------------------------------+
//| Script program start function |
//+------------------------------------------------------------------+
void OnStart()
{
2026-06-20 18:27:29 -05:00
//---
string json = "{\"ae\":[[10,10],[20,20]],\"comida\":\"holaaaaaaaaaaaaaa\\\\a\\\\a\\\\a\",\"trapo\":10.05,\"a\":true,\"invalid\":null}";
2026-06-18 10:50:55 -05:00
TSN::CJsonParser parser;
parser.Assing(json);
2026-07-20 10:27:49 -05:00
parser.CorrectPadding();
2026-06-18 10:50:55 -05:00
parser.Parse();
// Guardamos completo
parser.SaveCompiled("JsonParserByLeo\\jsontest.jsontc", true);
2026-06-18 11:40:47 -05:00
2026-06-18 10:50:55 -05:00
//---
long tape1[];
2026-06-20 18:27:29 -05:00
ArrayCopy(tape1, parser.m_cinta, 0, 0, parser.m_cinta_pos);
2026-06-18 10:50:55 -05:00
//---
parser.AssingFile("JsonParserByLeo\\jsontest.jsontc", true);
//---
long tape2[];
2026-06-20 18:27:29 -05:00
ArrayCopy(tape2, parser.m_cinta, 0, 0, parser.m_cinta_pos);
2026-06-18 10:50:55 -05:00
//---
PrintFormat("Es igaul = %s", (ArrayCompare(tape1, tape2) == 0 ? "si" : "no"));
}
//+------------------------------------------------------------------+