libOPNMIDI icon indicating copy to clipboard operation
libOPNMIDI copied to clipboard

Writing unit test with catch framework

Open jpcima opened this issue 6 years ago • 10 comments

I want to create unit tests for RT structures. User map, among things. Catch framework is difficult to work with because it a condensation of a lot of code in headers, requires lots of RAM.

Fortunately a person made very recently a minimal version for simple usage. link Do you mind switching to this version? After quick testing, RAM needs went down by 80%.

jpcima avatar Apr 22 '18 13:04 jpcima

I think, that would be useful, let's keep both versions, but use mainly this, I'll put the header as catchmini.hpp

Wohlstand avatar Apr 22 '18 21:04 Wohlstand

The mini version has two appreciable qualities from my side of things. 1) build faster 2) does not crash the computer by filling up memory.

After looking at the implemention of catch, I came to the conclusion there isn't possibility for separate compilation. The build tries to do all interprocedural optimizations and inlining, and just takes a lot of resources; to finish with a program of 5 times the size.

jpcima avatar Apr 22 '18 21:04 jpcima

On memory overflow my computer gets be crazy: it goes to freeze EVERYTHING and does HARD write of swap, I hate this... and I hate "modern" software which uses lots of memory for nothing... I better to kill the process that tried malloc() and gets the memory overflow that do that freaking swap crap...

Wohlstand avatar Apr 22 '18 21:04 Wohlstand

Yeah.. Maybe you know, but in linux you can enable a shortcut to invoke the oom killer, and get a chance to save your system if a crash is coming. (sysrq keys)

If I could do one thing to make computing better at a finger snap... Remove all Javascript. :smile:

jpcima avatar Apr 22 '18 22:04 jpcima

Yeah.. Maybe you know, but in linux you can enable a shortcut to invoke the oom killer, and get a chance to save your system if a crash is coming. (sysrq keys)

Yeah, OOM Killer is that I needed, and yeah I better to crash a jerk-process than freeze the entire system :fox_face:

If I could do one thing to make computing better at a finger snap... Remove all Javascript. smile

That is totally right! :laughing:

Wohlstand avatar Apr 22 '18 22:04 Wohlstand

I submitted a PR to the original catch project to make its build a lot more light and faster. Let's wait to see what happens.

jpcima avatar Apr 23 '18 08:04 jpcima

I see you have closed it, because of build fail on Catch's CI... And I see some of macOS builds are was failed: https://travis-ci.org/catchorg/Catch2/builds/370003489

Wohlstand avatar Apr 23 '18 10:04 Wohlstand

Oops :grin:, I had to press a wrong button... I don't want close this as issue is not completed

Wohlstand avatar Apr 23 '18 10:04 Wohlstand

These CI build have not failed by my fault. I added 15 lines of cmake which are inconsequential to the normal build.

jpcima avatar Apr 23 '18 10:04 jpcima

Yeah, I see the fault was because of mainstream-side crap: https://travis-ci.org/catchorg/Catch2/builds/369993994 (which is in fixing process)

Wohlstand avatar Apr 23 '18 10:04 Wohlstand