-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* Fixed CSV reader parsing frequencies. (#429) * Added unit tests.
- Loading branch information
1 parent
eddc554
commit 8715d77
Showing
4 changed files
with
66 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#include "tableformattest.hh" | ||
#include "config.hh" | ||
#include "csvreader.hh" | ||
#include <QTest> | ||
|
||
|
||
TableFormatTest::TableFormatTest(QObject *parent) | ||
: QObject{parent} | ||
{ | ||
// pass... | ||
} | ||
|
||
void | ||
TableFormatTest::testFrequencyParser() { | ||
Config config; | ||
|
||
QString data; | ||
QTextStream stream(&data); | ||
|
||
stream << "ID: 2621370" << Qt::endl | ||
<< "Name: \"DM3MAT\"" << Qt::endl | ||
<< "Digital Name Receive Transmit Power Scan TOT RO Admit CC TS RxGL TxC GPS Roam ID" << Qt::endl | ||
<< "1 \"test 0\" 439.56250 -7.60000 High - - - Color 1 1 - - - + - # Local" << Qt::endl | ||
<< "2 \"test 1\" 439.56250 +7.60000 High - - - Color 1 1 - - - + - # Sa/Th" << Qt::endl | ||
<< "3 \"test 2\" 439.56250 439.56250 High - - - Color 1 2 - - - + - # Regional" << Qt::endl; | ||
|
||
QString errMsg; | ||
QVERIFY2(CSVReader::read(&config, stream, errMsg), errMsg.toStdString().c_str()); | ||
|
||
QCOMPARE(config.channelList()->count(), 3); | ||
QCOMPARE(config.channelList()->channel(0)->rxFrequency(), Frequency::fromMHz(439.56250)); | ||
QCOMPARE(config.channelList()->channel(0)->txFrequency(), Frequency::fromMHz(431.96250)); | ||
QCOMPARE(config.channelList()->channel(1)->txFrequency(), Frequency::fromMHz(447.16250)); | ||
QCOMPARE(config.channelList()->channel(2)->txFrequency(), Frequency::fromMHz(439.56250)); | ||
} | ||
|
||
QTEST_GUILESS_MAIN(TableFormatTest) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#ifndef TABLEFORMATTEST_HH | ||
#define TABLEFORMATTEST_HH | ||
|
||
#include <QObject> | ||
|
||
|
||
class TableFormatTest : public QObject | ||
{ | ||
Q_OBJECT | ||
|
||
public: | ||
explicit TableFormatTest(QObject *parent = nullptr); | ||
|
||
private slots: | ||
void testFrequencyParser(); | ||
}; | ||
|
||
|
||
#endif // TABLEFORMATTEST_HH |