Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a425dedb authored by Tomasz Wasilczyk's avatar Tomasz Wasilczyk
Browse files

Allow spaces in DAB frequency labels and make it up to 7 characters long.

There is no standard for DAB label format, the regexp is based on our
partners knowledge.

Bug: 69958423
Test: VTS

Change-Id: I917508408de22f8a75d39d4e9badddd385869b03
parent 43a35464
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -215,7 +215,9 @@ struct DabTableEntry {
    /**
     * 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;

+4 −2
Original line number Diff line number Diff line
@@ -332,11 +332,13 @@ TEST_F(BroadcastRadioHalTest, GetDabRegionConfig) {
    }
    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));