Themabewertung:
  • 0 Bewertung(en) - 0 im Durchschnitt
  • 1
  • 2
  • 3
  • 4
  • 5
Unit testing
#3
Yeah, or something like this:
[ab3]INCLUDE "Unit1.ab3"

Function TestDoSomethingOK{}
in$ = "foo"
result$ = DoSomething{in$}
NPrint result$

ret = 0
If result$ = "foobar"
ret = 1
EndIf

Function Return ret
End Statement

Function TestDoSomethingFail{}
in$ = "foo"
result$ = DoSomething{in$}
NPrint result$

ret = 0
If result$ = "foobuzz"
ret = 1
EndIf

Function Return ret
End Statement


If TestDoSomethingOK{} = 0
NPrint "ERROR in DoSomething"
EndIf
If TestDoSomethingFail{} = 0
NPrint "ERROR in DoSomething, wrong result!"
EndIf[/ab3]

Is there a function for exiting from program, like Exit()?
That could be used if a test fails, instead of checking a return val.

Manfred
Zitieren


Nachrichten in diesem Thema

Gehe zu:


Benutzer, die gerade dieses Thema anschauen: 4 Gast/Gäste