I have the resource file in my PB folder and I linked the pure unit tool to the menu structure.
Say I have the following code in 2 files demoMain.pb and DemoTest.pb :
Code: Select all
Global var = 1
Procedure Go()
OpenConsole()
PrintN("test")
Delay(2000)
var = 4
EndProcedure
Go()
Delay(10000)
Code: Select all
XIncludeFile "demoMain.pb"
PureUnitOptions(NoUnicode, SubSystem[OpenGl])
ProcedureUnit TestGo()
Assert(var = 4)
EndProcedureUnit
when I run pure unit sometimes it fails and other times it passes and sometimes it almost seems like it doesn't detect changes in the first file.
for example global var will be set to 1 outside the go() procedure and then var will be 4 inside the go() procedure which would change the value outside of the go() procedure to 4 but then in the unit test file I'm stating that the var needs to be equal to 4. It will fail the unit test. I can confirm that the value is changing in the variable viewer debug tool.
I am probably not using pureunit correctly - is there another unit testing tool that works better or is there some documentation that I am missing - I've only read 1 forum post able weird behavior in pureunit from 2019 and the readme that comes with it in the directory.
Is there anywhere I can view some pureunit demo code that is more than the bit of code in the readme. Or do purebasic programs just not get extensively tested using pureunit. Am I just better off not unit testing using this language?
Thanks - sorry for the lengthy first post.