RosettaCodeData/Task/Assertions/Phix/assertions-2.phix

14 lines
486 B
Plaintext

global constant DEBUG = 0 -- (or any other identifier name can be used)
global procedure assert(integer flag, string msg)
if DEBUG then
if not flag then
{} = message_box(msg,"failed assertion",MB_OK) -- or
puts(1,msg) -- , and/or
crash(msg) -- crash/ex.err report -- or
trace(1) -- start debugging
end if
end if
end function
assert(i=42,"i is not 42!!")