-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Load ControllerMe On Initial Load * Add Function To Translate Facility Abbreviations Translates popular abbreviations of facilities (e.g. ESX -> ESSEX) for matching against the ControllerPositionCollection * ControllerPositionCollection Handles Special Positions Updated to properly recognise ESSEX, THAMES, SOLENT and their possible abbreviations * Linting * Bump Plugin Version * Comment To Trigger CI * Change Ownership Logging Logic It needs to log if there is no owner.
- Loading branch information
Showing
13 changed files
with
148 additions
and
5 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
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
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,23 @@ | ||
#include "pch/stdafx.h" | ||
#include "controller/TranslateFrequencyAbbreviation.h" | ||
|
||
namespace UKControllerPlugin { | ||
namespace Controller { | ||
|
||
std::map <std::string, std::string> translations = { | ||
{"ESX", "ESSEX"}, | ||
{"SOL", "SOLENT"}, | ||
{"THA", "THAMES"}, | ||
{"TMS", "THAMES"} | ||
}; | ||
|
||
/* | ||
Given a recognised abbreviation for a facility, translate | ||
it to the full facility for use in matching controller positions. | ||
*/ | ||
std::string TranslateFrequencyAbbreviation(std::string facility) | ||
{ | ||
return translations.count(facility) ? translations.at(facility) : facility; | ||
} | ||
} // namespace Controller | ||
} // namespace UKControllerPlugin |
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,8 @@ | ||
#pragma once | ||
|
||
namespace UKControllerPlugin { | ||
namespace Controller { | ||
|
||
std::string TranslateFrequencyAbbreviation(std::string facility); | ||
} // namespace Controller | ||
} // namespace UKControllerPlugin |
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
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
34 changes: 34 additions & 0 deletions
34
test/test/controller/TranslateFrequencyAbbreviationTest.cpp
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,34 @@ | ||
#include "pch/pch.h" | ||
#include "controller/TranslateFrequencyAbbreviation.h" | ||
|
||
using UKControllerPlugin::Controller::TranslateFrequencyAbbreviation; | ||
|
||
namespace UKControllerPluginTest { | ||
namespace Controller { | ||
|
||
TEST(TranslateFrequencyAbbreviation, ItTranslatesEssexAbbreviation) | ||
{ | ||
EXPECT_EQ("ESSEX", TranslateFrequencyAbbreviation("ESX")); | ||
} | ||
|
||
TEST(TranslateFrequencyAbbreviation, ItTranslatesSolentAbbreviation) | ||
{ | ||
EXPECT_EQ("SOLENT", TranslateFrequencyAbbreviation("SOL")); | ||
} | ||
|
||
TEST(TranslateFrequencyAbbreviation, ItTranslatesThamesAbbreviation) | ||
{ | ||
EXPECT_EQ("THAMES", TranslateFrequencyAbbreviation("THA")); | ||
} | ||
|
||
TEST(TranslateFrequencyAbbreviation, ItTranslatesThamesAbbreviation2) | ||
{ | ||
EXPECT_EQ("THAMES", TranslateFrequencyAbbreviation("TMS")); | ||
} | ||
|
||
TEST(TranslateFrequencyAbbreviation, ItReturnsFacilityIfNoTranslation) | ||
{ | ||
EXPECT_EQ("EGKK", TranslateFrequencyAbbreviation("EGKK")); | ||
} | ||
} // namespace Controller | ||
} // namespace UKControllerPluginTest |