Initial: flux text FoxBin2Prg (git urmareste .??2 in-arbore, binarele VFP git-ignored)

Include si sistemul de depanare/testare headless din Teste\ (harness UI cu capturi, verificare de sintaxa prin compilare, wrappere text<->binar) si docs\depanare_testare_flora2roa.md.
This commit is contained in:
2026-08-02 08:56:52 +03:00
commit 2736cbd525
49 changed files with 16011 additions and 0 deletions

55
Teste/test_helpers.prg Normal file
View File

@@ -0,0 +1,55 @@
* test_helpers.prg - proceduri comune testelor FLORA2ROA (handler de erori headless + aserturi).
* Se incarca automat din test_init_env_auto.prg cu SET PROCEDURE ... ADDITIVE.
* TestErrorHandler - ON ERROR pentru rulare fara consola: logheaza si continua
* TestAssert(cond, mesaj) - PASS/FAIL in log; incrementeaza gnTestFail la esec
* TestAssertEqual(asteptat, obtinut, mesaj)
* TestRezultat() - 'PASS'/'FAIL' + numarul de aserturi picate
* TestLog(mesaj) - scrie in gcUILog (harness) sau in gcTestErrLog
PROCEDURE TestErrorHandler
LPARAMETERS tnError, tcMessage, tcProgram, tnLine
LOCAL lcLinie
lcLinie = TTOC(DATETIME()) + ' EROARE ' + TRANSFORM(tnError) + ': ' + TRANSFORM(tcMessage) + ;
' | program: ' + TRANSFORM(tcProgram) + ' | linia: ' + TRANSFORM(tnLine)
IF TYPE('gcTestErrLog') = 'C' AND !EMPTY(gcTestErrLog)
SET SAFETY OFF
STRTOFILE(lcLinie + CHR(13) + CHR(10), gcTestErrLog, .T.)
ENDIF
TestLog(lcLinie)
ENDPROC
PROCEDURE TestLog
LPARAMETERS tcMesaj
IF TYPE('gcUILog') = 'C' AND !EMPTY(gcUILog)
DO HarnessLog WITH TRANSFORM(tcMesaj)
ENDIF
ENDPROC
FUNCTION TestAssert
LPARAMETERS tlConditie, tcMesaj
IF TYPE('gnTestFail') <> 'N'
PUBLIC gnTestFail
gnTestFail = 0
ENDIF
IF tlConditie
TestLog('PASS: ' + TRANSFORM(tcMesaj))
ELSE
gnTestFail = gnTestFail + 1
TestLog('FAIL: ' + TRANSFORM(tcMesaj))
ENDIF
RETURN tlConditie
ENDFUNC
FUNCTION TestAssertEqual
LPARAMETERS tuAsteptat, tuObtinut, tcMesaj
LOCAL llEgal
llEgal = (TRANSFORM(tuAsteptat) == TRANSFORM(tuObtinut))
RETURN TestAssert(llEgal, TRANSFORM(tcMesaj) + ' [asteptat: ' + TRANSFORM(tuAsteptat) + ;
' | obtinut: ' + TRANSFORM(tuObtinut) + ']')
ENDFUNC
FUNCTION TestRezultat
LOCAL lnFail
lnFail = IIF(TYPE('gnTestFail') = 'N', gnTestFail, 0)
RETURN IIF(lnFail = 0, 'PASS', 'FAIL (' + TRANSFORM(lnFail) + ' aserturi picate)')
ENDFUNC