Add tests for APRSParser

pull/32/head
Geoffrey Merck 4 years ago
parent abcfb23db2
commit fecd6633f7

@ -0,0 +1,38 @@
/*
* Copyright (c) 2021-2022 by Geoffrey Merck F4FXL / KC3FRA
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <gtest/gtest.h>
#include "../APRSParser.h"
class APRSParser_parseAPRSFrame_Tests : public ::testing::Test {
};
TEST_F(APRSParser_parseAPRSFrame_Tests, EmpyString) {
TAPRSFrame aprsFrame;
bool retVal = CAPRSParser::parseFrame("", aprsFrame);
EXPECT_FALSE(retVal);
EXPECT_STRCASEEQ(aprsFrame.m_body.c_str(), "");
EXPECT_STRCASEEQ(aprsFrame.m_dest.c_str(), "");
EXPECT_STRCASEEQ(aprsFrame.m_source.c_str(), "");
EXPECT_EQ(aprsFrame.m_type, APFT_UNKNOWN);
EXPECT_EQ(aprsFrame.m_path.size(), 0U);
}

@ -1,54 +0,0 @@
#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…
Cancel
Save

Powered by TurnKey Linux.