summaryrefslogtreecommitdiff
path: root/libs/pbd/test/testrunner.cc
blob: 11f60f46a2ddc7b2962be3df5281157cf7936990 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#include <cppunit/CompilerOutputter.h>
#include <cppunit/extensions/TestFactoryRegistry.h>
#include <cppunit/TestResult.h>
#include <cppunit/TestResultCollector.h>
#include <cppunit/TestRunner.h>
#include <cppunit/BriefTestProgressListener.h>
#include <glibmm/thread.h>
#include "scalar_properties.h"

#include "pbd/pbd.h"
#include "pbd/error.h"
#include "pbd/textreceiver.h"

int
main ()
{
	TextReceiver text_receiver ("pbd_test");

	if (!PBD::init ()) return 1;

	text_receiver.listen_to (PBD::error);
	text_receiver.listen_to (PBD::info);
	text_receiver.listen_to (PBD::fatal);
	text_receiver.listen_to (PBD::warning);

	ScalarPropertiesTest::make_property_quarks ();
	
	CppUnit::TestResult testresult;

	CppUnit::TestResultCollector collectedresults;
	testresult.addListener (&collectedresults);
	
	CppUnit::BriefTestProgressListener progress;
	testresult.addListener (&progress);
	
	CppUnit::TestRunner testrunner;
	testrunner.addTest (CppUnit::TestFactoryRegistry::getRegistry ().makeTest ());
	testrunner.run (testresult);
	
	CppUnit::CompilerOutputter compileroutputter (&collectedresults, std::cerr);
	compileroutputter.write ();

	PBD::cleanup ();

	return collectedresults.wasSuccessful () ? 0 : 1;
}