From ddb990a359865f6548852bd9b67df0d14ffa0cca Mon Sep 17 00:00:00 2001 From: Cedric Sirianni Date: Tue, 24 Oct 2023 16:04:26 -0400 Subject: [PATCH] refactor: use anonymous namespace for helper functions --- backend/test/password.cpp | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/backend/test/password.cpp b/backend/test/password.cpp index 7fa8976..228ca38 100644 --- a/backend/test/password.cpp +++ b/backend/test/password.cpp @@ -3,15 +3,18 @@ #include #include "../src/password.hpp" -bool hasLettersAndDigit(const std::string &password) +namespace { - const std::regex pattern("^(?=.*[a-z])(?=.*[A-Z])(?=.*\\d).+$"); - return regex_match(password, pattern); -} + bool hasLettersAndDigit(const std::string &password) + { + const std::regex pattern("^(?=.*[a-z])(?=.*[A-Z])(?=.*\\d).+$"); + return regex_match(password, pattern); + } -bool hasSymbol(const std::string &password) -{ - return password.find_first_not_of("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890") != std::string::npos; + bool hasSymbol(const std::string &password) + { + return password.find_first_not_of("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890") != std::string::npos; + } } TEST_CASE("Test generatePassword creates valid passwords")