cout and gdb for unit tests
In the process of writing unit tests I find my code generates seg faults. OK, sort of good, thats what the tests are for. The tests however suppress all cout output from the code they are testing, and will not cout themselves either. GDB also will not run over the unit test executable. Valgrind will, which is helpful, but does not always give line numbers. By and large the lack of couts make it extremely difficult to track the cause of the seg faults (is the test environment causing the problem, is the main code flawed, if so where, etc). Can anything be done about this? Thanks.
cerr should work but point taken
- Status changed from Open to Closed
- % Done changed from 0 to 100
Ah, cerr does work, fantastic. Thanks Chris.
- Status changed from Closed to Open
- Target version set to Future MAUS release
- % Done changed from 100 to 0
Yes, I thought cout works as well - maybe I forgot to reset it properly in a test. Let me check...
Ah no, I disabled cout because of all the Geant4 junk that obscures the test output...
- Status changed from Open to Rejected
I'll just reject the bug but I might be able to do something if its really irritating.
I'm satisfied. cout-ing everything would produce a mess, whereas now I can just add cerr as needed specifically for the tests.
in fact, already found and removed my seg fault.
Also available in: Atom