It is currently Mon Oct 14, 2019 11:32 pm

All times are UTC + 1 hour




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: Unexpected PureUnit results
PostPosted: Sat Jun 15, 2019 12:48 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Wed Sep 22, 2010 1:17 pm
Posts: 302
Location: United Kingdom
I'm writing some code which could usefully be unit tested, so I thought I'd give PureUnit a go for the first time. I couldn't get my initial test units to work properly so I went back to basics and tried a modified version of the example code from the readme - but I'm not getting the results I'm expecting from that either:
Code:
; Set the options.
; PureUnitOptions(NoUnicode, SubSystem[OpenGl])

; called once on program start
ProcedureUnitStartup startup()
  UnitDebug("Startup...")
EndProcedureUnit

; called once on program end
ProcedureUnitShutdown shutdown()
  UnitDebug("Shutdown...")
EndProcedureUnit

; Here comes our test procedures
ProcedureUnit passingtest()
 
  UnitDebug("passingtest...")
 
  Assert(#True = #True, "This should pass.")
 
EndProcedureUnit

ProcedureUnit failingtest()
 
  UnitDebug("failingtest...")
 
  Assert(#True <> #False, "If this fails, the world has gone crazy :)")
 
  For i = 1 To 10
    Continue
    Fail("This point should never be reaced")
  Next i
 
  ; here our test will fail.
  Assert(#True = #False, "This is bound to fail!")
 
EndProcedureUnit


This is the output from the gui log:
Code:
Using compiler: PureBasic 5.71 beta 1 LTS (Windows - x64)

Preparing file: DemoTest.pb
Compiling with: (no parameters)
Compiling with: /UNICODE

Stats: 0 successful tests in 1 files. (0 min, 35 sec)


And this is the log file:
Code:

PureUnit - Test report

Statistics:

    Date:    06/15/2019 - 12:19:22
    PureUnit Version:    PureUnit 1.1 - (c) 2016 Fantaisie Software
    Compiler Version:    PureBasic 5.71 beta 1 LTS (Windows - x64)
    Operatingsystem:    
    Testfiles:    1 (1 correct, 0 with errors, 0 skipped)
    Successful tests:    0
    Failures:    0
    Parser Warnings:    0
    Options:    Resume tests after errors.
    Testing time:    0 minutes, 34 seconds
    Status:    All tests completed.


Base Directory:

    P:\Unit Tests\

Correct files:

    DemoTest.pb



This log content is not meeting my expectations however as follows:-

1) The passing test should always work so I'm expecting 2 passes.
2) The 'failingtest' procedure has a static assertion failure (#True = #False), so I'm expecting 2 failures (once in no flags, once in UNICODE).
3) I'm expecting some message content from the failing assert and also the UnitDebug statements in the other procedures.

I've tested this on PB 5.62 32- and 64-bit gui and console and also 5.71B1 64-bit on Windows 7 and I'm getting the same output from all.

Are my expectations correct? Does anyone else's results match/differ to mine?
PureUnit isn't particularly verbose even with the /VERBOSE switch - is there anything else I can do to debug this?


Top
 Profile  
Reply with quote  
 Post subject: Re: Unexpected PureUnit results
PostPosted: Sat Jun 15, 2019 2:23 pm 
Offline
Addict
Addict

Joined: Thu Aug 30, 2007 11:54 pm
Posts: 1101
Location: right here
It seems to work here (linux)

from commandline
Code:
[user]~/purebasic_571_b1/sdk/pureunit>./pureunit --compiler ~/purebasic_571_b1/compilers/pbcompiler /media/user/USB16/pb2016/testpb/pureunittest/test2.pb
     File: /media/user/USB16/pb2016/testpb/pureunittest/test2.pb
     Line: 35
 Compiled: (no parameters)
     Test: failingtest()
  Message: This is bound to fail!

  Assert(#True = #False) failed!
Stats: Failure after 1 successful tests in 1 files. (0 min, 0 sec)


with gui
Code:
Using compiler: PureBasic 5.71 beta 1 LTS (Linux - x64)

Preparing file: test2.pb
Compiling with: (no parameters)
Debug: Startup...
  Test 1 of 2: passingtest()
Debug: passingtest...
  Test 2 of 2: failingtest()
Debug: failingtest...

File: test2.pb
Line: 35
Compiled: (no parameters)
Test: failingtest()
Message: This is bound to fail!

  Assert(#True = #False) failed!
Debug: Shutdown...

Stats: Failure after 1 successful tests in 1 files. (0 min, 1 sec)


Yours also says '35 sec'. Does it actually take that long?


Top
 Profile  
Reply with quote  
 Post subject: Re: Unexpected PureUnit results
PostPosted: Sat Jun 15, 2019 3:05 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Wed Sep 22, 2010 1:17 pm
Posts: 302
Location: United Kingdom
#NULL wrote:
It seems to work here (linux).
Yours also says '35 sec'. Does it actually take that long?

It does indeed - which also seems excessive to me too but not having done this before I didn't know if my expectation was unreasonable.


Top
 Profile  
Reply with quote  
 Post subject: Re: Unexpected PureUnit results
PostPosted: Sat Jun 15, 2019 4:12 pm 
Offline
Addict
Addict

Joined: Thu Aug 30, 2007 11:54 pm
Posts: 1101
Location: right here
I tried with Windows 10 x64 and it works there too. What options did you use in the pureunit gui? Did you copy the pureunit residents file over? Is the pureunit from the same pb version as the used compiler? Is the pb file actually utf-8 encoded? Maybe Try a directory without spaces in the name? Any special compiler options stored in the pb file? Any anti-virus software? Just guessing :)


Top
 Profile  
Reply with quote  
 Post subject: Re: Unexpected PureUnit results
PostPosted: Sat Jun 15, 2019 7:30 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Wed Sep 22, 2010 1:17 pm
Posts: 302
Location: United Kingdom
Thanks for the hints about compilation times and AV - that put me on the right track...

Turns out it was the anti-virus - apparently it decided to dump my custom configuration, including my list of exceptions and the settings about showing warning messages and writing log entries which is really...

This is the last straw - it has GOT to go! :evil:


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 13 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye