Coverage for lobster/tools/cpptest/constants.py: 100%
22 statements
« prev ^ index » next coverage.py v7.10.7, created at 2026-09-22 04:43 +0000
« prev ^ index » next coverage.py v7.10.7, created at 2026-09-22 04:43 +0000
1# LOBSTER - Lightweight Open BMW Software Traceability Evidence Report
2# Copyright (C) 2024-2026 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
3#
4# This program is free software: you can redistribute it and/or modify
5# it under the terms of the GNU Affero General Public License as
6# published by the Free Software Foundation, either version 3 of the
7# License, or (at your option) any later version.
8#
9# This program is distributed in the hope that it will be useful, but
10# WITHOUT ANY WARRANTY; without even the implied warranty of
11# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12# Affero General Public License for more details.
13#
14# You should have received a copy of the GNU Affero General Public
15# License along with this program. If not, see
16# <https://www.gnu.org/licenses/>.
18import re
21class Constants:
22 def __init__(self, codebeamer_url = ''):
24 self.codebeamer_link = codebeamer_url + "/issue/"
25 self.requirement = re.compile(r'@requirement[\s\S]*?(?=@|\Z)')
26 self.requirement_tag_http = (
27 rf"([@\\]requirement(\s+(CB-#\d+\s+)*"
28 rf"({self.codebeamer_link}\d+\s*,?\s*/*\*?)+)+)"
29 )
30 self.requirement_tag_http_named = rf"({self.codebeamer_link}(?P<number>\d+))"
32 NON_EXISTING_INFO = "---"
34 LOBSTER_GENERATOR = "lobster-cpptest"
36 VALID_TESTMETHODS = [
37 "TM_EQUIVALENCE",
38 "TM_PAIRWISE",
39 "TM_GUESSING",
40 "TM_BOUNDARY",
41 "TM_CONDITION",
42 "TM_REQUIREMENT",
43 "TM_TABLE",
44 ]
46 VALID_TEST_MACROS = [
47 "TEST",
48 "TEST_P",
49 "TEST_F",
50 "TYPED_TEST",
51 "TYPED_TEST_P",
52 "TYPED_TEST_SUITE",
53 "TEST_P_INSTANCE",
54 "TEST_F_INSTANCE",
55 ]
57 TEST_CASE_INTRO = re.compile(r"^\s*(" +
58 "|".join(VALID_TEST_MACROS) +
59 r")\s*\(")
60 TEST_CASE_INFO = re.compile(
61 r"^\s*(" + "|".join(VALID_TEST_MACROS) +
62 r")\s*\(\s*(?P<suite_name>\w+),\s*(?P<test_name>\w+)\)"
63 )
64 REQUIREMENT_TAG = r"(CB-#\d+)"
66 REQUIRED_BY = re.compile(r".*[@\\]requiredby\s+([\s*/]*(\w*::\w+),?\s*)+")
67 REQUIRED_BY_TAG = r"(\w*::\w+)"
68 DEFECT = re.compile(
69 r"(@defect\s+)(((?:(CB-#\d+)|(OCT-#\d+)),?\s*)+)" +
70 r"(?:///|/)\s+(((?:(CB-#\d+)|(OCT-#\d+)),?\s)+)?"
71 )
72 BRIEF = re.compile(r"(@brief\s+)([^@]+)")
73 VERSION = re.compile(r"(@version\s+)(\d+([,]? \d+)*)+")
74 OCT_TAG = r"(OCT-#\d+)"
75 TESTMETHODS = re.compile(r"(@testmethods\s+)([^@]+)")
76 TEST = re.compile(r"(@test\s+)([^@]+)")