parent
249af92976
commit
cf6116fd7a
@ -0,0 +1,25 @@
|
|||||||
|
|
||||||
|
SRCS = $(wildcard *.cpp) $(wildcard ../*.cpp)
|
||||||
|
OBJS = $(SRCS:.cpp=.o)
|
||||||
|
DEPS = $(SRCS:.cpp=.d)
|
||||||
|
|
||||||
|
.PHONY tests:
|
||||||
|
tests: rmdstargatewayapp $(OBJS)
|
||||||
|
$(CC) $(CPPFLAGS) -o dstargateway_tests $(OBJS) $(LDFLAGS) -lgtest -lgtest_main
|
||||||
|
|
||||||
|
%.o : %.cpp
|
||||||
|
$(CC) $(CPPFLAGS) -DUNIT_TESTS -I../ -MMD -MD -c $< -o $@
|
||||||
|
|
||||||
|
-include $(DEPS)
|
||||||
|
|
||||||
|
.PHONY clean :
|
||||||
|
clean :
|
||||||
|
@$(RM) $(OBJS) $(DEPS) dstargateway_tests
|
||||||
|
|
||||||
|
|
||||||
|
.PHONY rmdstargatewayapp :
|
||||||
|
rmdstargatewayapp: FORCE
|
||||||
|
@$(RM) ../DStarGatewayApp.o
|
||||||
|
@$(RM) ../DStarGatewayApp.d
|
||||||
|
|
||||||
|
FORCE:
|
||||||
@ -0,0 +1,54 @@
|
|||||||
|
|
||||||
|
|
||||||
|
#include <gtest/gtest.h>
|
||||||
|
|
||||||
|
#include <APRSParser.h>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// The fixture for testing class Foo.
|
||||||
|
class FooTest : public ::testing::Test {
|
||||||
|
protected:
|
||||||
|
// You can remove any or all of the following functions if their bodies would
|
||||||
|
// be empty.
|
||||||
|
|
||||||
|
FooTest() {
|
||||||
|
// You can do set-up work for each test here.
|
||||||
|
}
|
||||||
|
|
||||||
|
~FooTest() override {
|
||||||
|
// You can do clean-up work that doesn't throw exceptions here.
|
||||||
|
}
|
||||||
|
|
||||||
|
// If the constructor and destructor are not enough for setting up
|
||||||
|
// and cleaning up each test, you can define the following methods:
|
||||||
|
|
||||||
|
void SetUp() override {
|
||||||
|
// Code here will be called immediately after the constructor (right
|
||||||
|
// before each test).
|
||||||
|
}
|
||||||
|
|
||||||
|
void TearDown() override {
|
||||||
|
// Code here will be called immediately after each test (right
|
||||||
|
// before the destructor).
|
||||||
|
}
|
||||||
|
|
||||||
|
// Class members declared here can be used by all tests in the test suite
|
||||||
|
// for Foo.
|
||||||
|
};
|
||||||
|
|
||||||
|
// Tests that the Foo::Bar() method does Abc.
|
||||||
|
TEST_F(FooTest, MethodBarDoesAbc) {
|
||||||
|
const std::string input_filepath = "this/package/testdata/myinputfile.dat";
|
||||||
|
const std::string output_filepath = "this/package/testdata/myoutputfile.dat";
|
||||||
|
|
||||||
|
TAPRSFrame frame;
|
||||||
|
CAPRSParser::parseFrame("bla", frame);
|
||||||
|
|
||||||
|
EXPECT_EQ(frame.m_type, APFT_MESSAGE);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Tests that Foo does Xyz.
|
||||||
|
TEST_F(FooTest, DoesXyz) {
|
||||||
|
// Exercises the Xyz feature of Foo.
|
||||||
|
}
|
||||||
Loading…
Reference in new issue