/QMK-Groundstation/branches/libMK/testing/HandlerTest.cpp |
---|
0,0 → 1,12 |
#include "HandlerTest.h" |
void HandlerTest::setUp(void) { |
handler = new Handler(&com, &data); |
}; |
void HandlerTest::get_flightctrl_settings_test(void) { |
handler->get_flightctrl_settings(0); |
}; |
void HandlerTest::tearDown(void) { |
}; |
/QMK-Groundstation/branches/libMK/testing/HandlerTest.h |
---|
0,0 → 1,31 |
#ifndef HANDLER_TEST_H |
#define HANDLER_TEST_H |
#include <cppunit/TestFixture.h> |
#include <cppunit/extensions/HelperMacros.h> |
#include "../libMK/Handler.h" |
#include "../libMK/Kopter.h" |
#include "../libMK/Communication.h" |
class HandlerTest : public CPPUNIT_NS :: TestFixture |
{ |
CPPUNIT_TEST_SUITE (HandlerTest); |
CPPUNIT_TEST (get_flightctrl_settings_test); |
CPPUNIT_TEST_SUITE_END (); |
public: |
void setUp (void); |
void tearDown (void); |
protected: |
void get_flightctrl_settings_test(void); |
private: |
KopterData data; |
Communication com; |
Handler * handler; |
}; |
CPPUNIT_TEST_SUITE_REGISTRATION( HandlerTest ); |
#endif |
/QMK-Groundstation/branches/libMK/testing/Makefile |
---|
0,0 → 1,30 |
CPP = g++ |
CCFLAGS = -c #-g -ansi |
LIBS = /usr/lib/libcppunit.a -L"../libMK" |
INCS = -I"./" -I"../" -I"../libMK" |
%.o : %.cpp |
$(CPP) $(CCFLAGS) -c $< |
LINKOBJ = ../libMK/*.o |
OBJ = HandlerTest.o main.o |
LIBMK = libMK |
LIBMK_DIR = ../libMK/ |
all: $(LIBMK) test |
test: $(OBJ) |
${CPP} -o test $(LINKOBJ) $(OBJ) ${LIBS} |
./test |
$(LIBMK): |
$(MAKE) -C $(LIBMK_DIR) |
main.o: main.cpp |
HandlerTest.o: HandlerTest.cpp |
#ParserTest.o: ParserTest.cpp |
clean: |
rm -f *.o test; \ |
$(MAKE) -C $(LIBMK_DIR) clean |
/QMK-Groundstation/branches/libMK/testing/main.cpp |
---|
0,0 → 1,32 |
#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> |
int main( int argc, char* argv[] ) |
{ |
// Create the event manager and test controller |
CPPUNIT_NS::TestResult controller; |
// Add a listener that colllects test result |
CPPUNIT_NS::TestResultCollector result; |
controller.addListener( &result ); |
// Add a listener to show progress of single tests |
CPPUNIT_NS :: BriefTestProgressListener progress; |
controller.addListener (&progress); |
// Add the top suite to the test runner |
CPPUNIT_NS::TestRunner runner; |
runner.addTest( CPPUNIT_NS::TestFactoryRegistry::getRegistry().makeTest() ); |
runner.run( controller ); |
// Print test in a compiler compatible format. |
CPPUNIT_NS::CompilerOutputter outputter( &result, std::cerr ); |
outputter.write(); |
return result.wasSuccessful() ? 0 : 1; |
} |