Merge "Allow spaces in DAB frequency labels and make it up to 7 characters long."
diff --git a/broadcastradio/2.0/types.hal b/broadcastradio/2.0/types.hal
index 1fd3715..003c444 100644
--- a/broadcastradio/2.0/types.hal
+++ b/broadcastradio/2.0/types.hal
@@ -215,7 +215,9 @@
/**
* Channel name, i.e. 5A, 7B.
*
- * It must match the following regular expression: /^[A-Z0-9]{2,5}$/.
+ * It must match the following regular expression:
+ * /^[A-Z0-9][A-Z0-9 ]{0,5}[A-Z0-9]$/ (2-7 uppercase alphanumeric characters
+ * without spaces allowed at the beginning nor end).
*/
string label;
diff --git a/broadcastradio/2.0/vts/functional/VtsHalBroadcastradioV2_0TargetTest.cpp b/broadcastradio/2.0/vts/functional/VtsHalBroadcastradioV2_0TargetTest.cpp
index feb62c6..1ecf615 100644
--- a/broadcastradio/2.0/vts/functional/VtsHalBroadcastradioV2_0TargetTest.cpp
+++ b/broadcastradio/2.0/vts/functional/VtsHalBroadcastradioV2_0TargetTest.cpp
@@ -342,11 +342,13 @@
}
ASSERT_EQ(Result::OK, halResult);
- std::regex re("^[A-Z0-9]{2,5}$");
+ std::regex re("^[A-Z0-9][A-Z0-9 ]{0,5}[A-Z0-9]$");
// double-check correctness of the test
ASSERT_TRUE(std::regex_match("5A", re));
ASSERT_FALSE(std::regex_match("5a", re));
- ASSERT_FALSE(std::regex_match("123ABC", re));
+ ASSERT_FALSE(std::regex_match("1234ABCD", re));
+ ASSERT_TRUE(std::regex_match("CN 12D", re));
+ ASSERT_FALSE(std::regex_match(" 5A", re));
for (auto&& entry : config) {
EXPECT_TRUE(std::regex_match(std::string(entry.label), re));