LCOV - code coverage report
Current view: top level - test/lexicalAnalysis - test_regexWrapper.cc (source / functions) Coverage Total Hit
Test: coverage.info Lines: 100.0 % 33 33
Test Date: 2025-04-18 15:53:49 Functions: 100.0 % 1 1

            Line data    Source code
       1              : #include "../inc/lexicalAnalysis/regexWrapper.h"
       2              : #include <catch2/catch_test_macros.hpp>
       3              : 
       4           45 : TEST_CASE("Pruebas de la clase RegexWrapper", "[regexwrapper]") {
       5           45 :   using nicole::RegexWrapper;
       6              : 
       7           45 :   SECTION("Constructor y métodos de acceso") {
       8            9 :     const RegexWrapper regex{"\\d+"};
       9            9 :     REQUIRE(regex.str() == "\\d+");
      10            9 :     REQUIRE(regex.match("12345"));
      11            9 :     REQUIRE_FALSE(regex.match("abc"));
      12            9 :   }
      13              : 
      14           45 :   SECTION("Coincidencia exacta") {
      15            9 :     const RegexWrapper regex{"^abc$"};
      16            9 :     REQUIRE(regex.match("abc"));
      17            9 :     REQUIRE_FALSE(regex.match(" abc "));
      18            9 :     REQUIRE_FALSE(regex.match("abcd"));
      19            9 :   }
      20              : 
      21           45 :   SECTION("Patrón vacío") {
      22            9 :     const RegexWrapper regex{""};
      23            9 :     REQUIRE(regex.str().empty());
      24            9 :     REQUIRE(regex.match(""));
      25            9 :     REQUIRE_FALSE(regex.match("a"));
      26            9 :   }
      27              : 
      28           45 :   SECTION("Patrón de letras minúsculas") {
      29            9 :     const RegexWrapper regex{"^[a-z]+$"};
      30            9 :     REQUIRE(regex.match("abcxyz"));
      31            9 :     REQUIRE_FALSE(regex.match("ABC"));
      32            9 :     REQUIRE_FALSE(regex.match("abc123"));
      33            9 :   }
      34              : 
      35           45 :   SECTION("Patrón de dígitos y letras") {
      36            9 :     const RegexWrapper regex{"^[a-zA-Z0-9]+$"};
      37            9 :     REQUIRE(regex.match("abc123XYZ"));
      38            9 :     REQUIRE_FALSE(regex.match("abc-123"));
      39            9 :     REQUIRE_FALSE(regex.match("abc 123"));
      40            9 :   }
      41           45 : }
        

Generated by: LCOV version 2.0-1