From 8f9a7ce74d78ee97e928ff7ae5ee9a7c882d989f Mon Sep 17 00:00:00 2001 From: "Tannaz Vahidi (ext.)" Date: Mon, 27 Jan 2025 16:27:13 +0100 Subject: [PATCH] Evaluation of lobster-regex tool Denfine new requirements and one system test for -happy path- --- .../data/test_case_20241203124123.cpp | 236 +++++++++++++++++ .../data/test_case_20250116084602.cpp | 238 ++++++++++++++++++ .idea/.gitignore | 3 + .idea/inspectionProfiles/Project_Default.xml | 30 +++ .../inspectionProfiles/profiles_settings.xml | 6 + .idea/lobster.iml | 7 + .idea/misc.xml | 7 + .idea/vcs.xml | 6 + lobster/tools/regex/__init__.py | 0 lobster/tools/regex/requirements.trlc | 83 ++++++ lobster/tools/requirements.rsl | 23 ++ .../lobster-regex/data/test_case.scala | 72 ++++++ .../expected-output/exit-code.txt | 1 + .../expected-output/output.lobster | 81 ++++++ .../expected-output/stderr.txt | 0 .../expected-output/stdout.txt | 1 + .../input/args.txt | 1 + .../input/default_file.yaml | 18 ++ 18 files changed, 813 insertions(+) create mode 100644 .history/tests-unit/lobster-cpptest/data/test_case_20241203124123.cpp create mode 100644 .history/tests-unit/lobster-cpptest/data/test_case_20250116084602.cpp create mode 100644 .idea/.gitignore create mode 100644 .idea/inspectionProfiles/Project_Default.xml create mode 100644 .idea/inspectionProfiles/profiles_settings.xml create mode 100644 .idea/lobster.iml create mode 100644 .idea/misc.xml create mode 100644 .idea/vcs.xml create mode 100644 lobster/tools/regex/__init__.py create mode 100644 lobster/tools/regex/requirements.trlc create mode 100644 tests-system/lobster-regex/data/test_case.scala create mode 100644 tests-system/lobster-regex/rbt-valid-input-config/valid-config-file-and-path-scenario/expected-output/exit-code.txt create mode 100644 tests-system/lobster-regex/rbt-valid-input-config/valid-config-file-and-path-scenario/expected-output/output.lobster create mode 100644 tests-system/lobster-regex/rbt-valid-input-config/valid-config-file-and-path-scenario/expected-output/stderr.txt create mode 100644 tests-system/lobster-regex/rbt-valid-input-config/valid-config-file-and-path-scenario/expected-output/stdout.txt create mode 100644 tests-system/lobster-regex/rbt-valid-input-config/valid-config-file-and-path-scenario/input/args.txt create mode 100644 tests-system/lobster-regex/rbt-valid-input-config/valid-config-file-and-path-scenario/input/default_file.yaml diff --git a/.history/tests-unit/lobster-cpptest/data/test_case_20241203124123.cpp b/.history/tests-unit/lobster-cpptest/data/test_case_20241203124123.cpp new file mode 100644 index 00000000..44408b9a --- /dev/null +++ b/.history/tests-unit/lobster-cpptest/data/test_case_20241203124123.cpp @@ -0,0 +1,236 @@ +/** ensure all desired test macros are parsed */ + +TEST_P_INSTANCE(TestMacrosTest, TestPInstance) {} +TEST(TestMacrosTest, TestTest) {} +TEST_F(TestMacrosTest1, TestTestF) {} +TEST_P(TestMacrosTest1, TestTestP) {} +TYPED_TEST(TestMacrosTest2, TestTypedTest) {} +TYPED_TEST_P(TestMacrosTest2, TestTypedTestP) {} +TYPED_TEST_SUITE(TestMacrosTest2, TestTypedTestSuite) {} +TEST_F_INSTANCE(TestMacrosTest3, TestFInstance) {} + +/** ensure test implementation is correctly parsed */ + +TEST( + ImplementationTest, + TestMultiLine +) {} + +TEST(ImplementationTest, EmptyImplementation) {} + +TEST(ImplementationTest, ImplementationMultipleLines) { + EXPECT_EQ(true, DummyFunctionForValidCondition()); +} + +TEST(ImplementationTest, MultipleLinesWithComments) +{ + // Some comments + EXPECT_EQ(true, DummyFunctionForValidCondition()); + // Some other comments +} + +/** ensure test tag is correctly parsed */ + +/// @test foo1 +TEST(TestTagTest, TestTagInOnline) {} + +/// +/// @test foo2 +TEST(TestTagTest, TestTagPrecededByComment) {} + +/// @test foo3 +/// +TEST(TestTagTest, TestTagFollowedByComment) {} + +/// +/// @test foo4 +/// +TEST(TestTagTest, TestTagWithCommentsAround) {} + +/// @test lorem ipsum +TEST(TestTagTest, TestTagAsText) {} + +/** ensure brief are parsed correctly */ + +/// @brief Some nasty bug1 +TEST(BriefTagTest, BriefTagInOnline) {} + +/// @brief This is a brief field +/// with a long description +TEST(BriefTagTest, BriefTagMultipleLines) {} + +/** ensure requirement tags are parse correctly */ + +/// @requirement CB-#0815 +TEST(RequirementTagTest, Requirement) {} + +/** @requirement CB-#0815 CB-#0816 */ +TEST(RequirementTagTest1, RequirementAsOneLineComments) {} + +/** + * @requirement CB-#0815 CB-#0816 + */ +TEST(RequirementTagTest1, RequirementAsComments) {} + +/** + * @requirement CB-#0815, CB-#0816, + * CB-#0817 + * @requirement CB-#0818 CB-#0819 + * CB-#0820 + */ +TEST(RequirementTagTest1, RequirementsAsMultipleComments) {} + +/// +/// @requirement https://codebeamer.company.net/cb/issue/0815 +/// +TEST(RequirementTagTest2, URLRequirement) {} + +/// +/// @requirement https://codebeamer.company.net/cb/issue/0815, +/// https://codebeamer.company.net/cb/issue/0816 +/// +TEST(RequirementTagTest2, URLRequirementsCommaSeparated) {} + +/** + * @requirement https://codebeamer.company.net/cb/issue/0815 + * https://codebeamer.company.net/cb/issue/0816 + */ +TEST(RequirementTagTest2, URLRequirementsAsCommentsSpaceSeparated) {} + +/** + * @requirement https://codebeamer.company.net/cb/issue/0815, https://codebeamer.company.net/cb/issue/0816 + * @requirement https://codebeamer.company.net/cb/issue/0817 + * https://codebeamer.company.net/cb/issue/0818 + */ +TEST(RequirementTagTest2, MultipleURLRequirements) {} + +/// +/// @requirement https://codebeamer.company.net/cb/issue/0815 +/// @requirement CB-#0816 +/// +TEST(RequirementTagTest3, MixedRequirements) {} + +/// +/// @requirement something_arbitrary +/// +TEST(RequirementTagTest4, InvalidRequirement) {} + +/// +/// @requirement +/// +TEST(RequirementTagTest4, MissingRequirementReference) {} + +/** ensure required-by tags are parsed correctly */ + +/// +/// @requiredby FOO0::BAR0 +/// +TEST(RequirementByTest1, RequiredByWithAt) {} + +/// +/// @requiredby FOO0::BAR0, FOO1::BAR1 +/// +TEST(RequirementByTest1, MultipleRequiredByCommaSeparated) {} + +/** + * @requiredby FOO0::BAR0, FOO1::BAR1, + * FOO2::BAR2 + * @requiredby FOO3::BAR3 FOO4::BAR4, + * FOO5::BAR5 + * @requiredby FOO6::BAR6 FOO7::BAR7 + * FOO8::BAR8 + */ +TEST(RequirementByTest1, MultipleRequiredByAsComments) {} + +/// @test lorem ipsum +/// @requiredby FOO0::BAR0, +/// FOO1::BAR1, +/// FOO2::BAR2, +/// FOO3::BAR3, +/// FOO4::BAR4, +/// FOO5::BAR5, +/// FOO6::BAR6, +/// FOO7::BAR7, +/// FOO8::BAR8 +/// +TEST(RequirementByTest2, RequiredByWithNewLines) {} + +/** ensure testmethods are parsed correctly */ + +/// @testmethods TM_REQUIREMENT +TEST(TestMethodsTagTest, TestMethod) {} + +/** + * @testmethods TM_PAIRWISE TM_BOUNDARY + */ +TEST(TestMethodsTagTest2, TestMethodAsCommentsSpaceSeparated) {} + +/// @testmethods TM_REQUIREMENT, TM_EQUIVALENCE +TEST(TestMethodsTagTest2, TestMethodAsCommentsCommaSeparated) {} + +// /// @testmethods TM_REQUIREMENT, TM_EQUIVALENCE +// /// @testmethods TM_BOUNDARY, TM_CONDITION +// TEST(TestMethodsTagTest2, TestMethodAsCommentsMultipleLines) {} + +/// +/// @testmethods something_arbitrary +/// +TEST(TestMethodsTagTest3, InvalidTestMethod) {} + +/// +/// @testmethods +/// +TEST(TestMethodsTagTest4, MissingTestMethod) {} + +/** ensure version are parsed correctly */ + +/// @version 1 +TEST(VersionTagTest, VersionTagTestInOnline) {} + +/// @version 1, 42 +TEST(VersionTagTest, MultipleVersionTagTestInOnline) {} + +/// @requirement CB-#0815 +/// @version 12, 70 +TEST(VersionTagTest, MoreVersionsThanRequirements) {} + +/// @requirement CB-#0815, CB-#0816 +/// @version 28 +TEST(VersionTagTest, MoreRequirementsThanVersions) {} + +/// @requirement CB-#123 CB-#456 +/// @version 28 99 +TEST(VersionTagTest, VersionSpaceSeparated) {} + +/** ensure everything is parsed correctly at once */ + +/// +/// @test foo +/// @brief this test tests something +/// @version 42, 2 +/// @requirement CB-#0815, CB-#0816 +/// @requiredby FOO0::BAR0 +/// @testmethods TM_BOUNDARY, TM_REQUIREMENT +/// +TEST(AllTogetherTest, ImplementationMultipleLines) { + EXPECT_EQ(true, DummyFunctionForValidCondition()); +} + +/** + * commented test cases + */ +// TEST(LayoutTest1, SingleComment){} +/* TEST(LayoutTest2, InlineComment){} */ +/* + * TEST(LayoutTest2, Comment) {} + */ + +/** + * invalid test cases + * the following tests should not be parsed + * as valid test cases + */ +TEST(InvalidTest1,) {} +TEST(, InvalidTest2) {} +TEST(,) {} +TEST() {} diff --git a/.history/tests-unit/lobster-cpptest/data/test_case_20250116084602.cpp b/.history/tests-unit/lobster-cpptest/data/test_case_20250116084602.cpp new file mode 100644 index 00000000..613538c5 --- /dev/null +++ b/.history/tests-unit/lobster-cpptest/data/test_case_20250116084602.cpp @@ -0,0 +1,238 @@ +/** ensure all desired test macros are parsed */ + +TEST_P_INSTANCE(TestMacrosTest, TestPInstance) {} +TEST(TestMacrosTest, TestTest) {} +TEST_F(TestMacrosTest1, TestTestF) {} +TEST_P(TestMacrosTest1, TestTestP) {} +TYPED_TEST(TestMacrosTest2, TestTypedTest) {} +TYPED_TEST_P(TestMacrosTest2, TestTypedTestP) {} +TYPED_TEST_SUITE(TestMacrosTest2, TestTypedTestSuite) {} +TEST_F_INSTANCE(TestMacrosTest3, TestFInstance) {} + +/** ensure test implementation is correctly parsed */ + +TEST( + ImplementationTest, + TestMultiLine +) {} + +TEST(ImplementationTest, EmptyImplementation) {} + +TEST(ImplementationTest, ImplementationMultipleLines) { + EXPECT_EQ(true, DummyFunctionForValidCondition()); +} + +TEST(ImplementationTest, MultipleLinesWithComments) +{ + // Some comments + EXPECT_EQ(true, DummyFunctionForValidCondition()); + // Some other comments +} + +/** ensure test tag is correctly parsed */ + +/// @test foo1 +TEST(TestTagTest, TestTagInOnline) {} + +/// +/// @test foo2 +TEST(TestTagTest, TestTagPrecededByComment) {} + +/// @test foo3 +/// +TEST(TestTagTest, TestTagFollowedByComment) {} + +/// +/// @test foo4 +/// +TEST(TestTagTest, TestTagWithCommentsAround) {} + +/// @test lorem ipsum +TEST(TestTagTest, TestTagAsText) {} + +/** ensure brief are parsed correctly */ + +/// @brief Some nasty bug1 +TEST(BriefTagTest, BriefTagInOnline) {} + +/// @brief This is a brief field +/// with a long description +TEST(BriefTagTest, BriefTagMultipleLines) {} + +/** ensure requirement tags are parse correctly */ + +/// @requirement CB-#0815 +TEST(RequirementTagTest, Requirement) {} + +/** @requirement CB-#0815 CB-#0816 */ +TEST(RequirementTagTest1, RequirementAsOneLineComments) {} + +/** + * @requirement CB-#0815 CB-#0816 + */ +TEST(RequirementTagTest1, RequirementAsComments) {} + +/** + * @requirement CB-#0815, CB-#0816, + * CB-#0817 + **/ +TEST(RequirementTagTest1, RequirementsAsMultipleComments) {} //@requirement CB-#1111 +/** + * @requirement CB-#0818 CB-#0819 + * CB-#0820 + */ + +/// +/// @requirement https://codebeamer.company.net/cb/issue/0815 +/// +TEST(RequirementTagTest2, URLRequirement) {} + +/// +/// @requirement https://codebeamer.company.net/cb/issue/0815, +/// https://codebeamer.company.net/cb/issue/0816 +/// +TEST(RequirementTagTest2, URLRequirementsCommaSeparated) {} + +/** + * @requirement https://codebeamer.company.net/cb/issue/0815 + * https://codebeamer.company.net/cb/issue/0816 + */ +TEST(RequirementTagTest2, URLRequirementsAsCommentsSpaceSeparated) {} + +/** + * @requirement https://codebeamer.company.net/cb/issue/0815, https://codebeamer.company.net/cb/issue/0816 + * @requirement https://codebeamer.company.net/cb/issue/0817 + * https://codebeamer.company.net/cb/issue/0818 + */ +TEST(RequirementTagTest2, MultipleURLRequirements) {} + +/// +/// @requirement https://codebeamer.company.net/cb/issue/0815 +/// @requirement CB-#0816 +/// +TEST(RequirementTagTest3, MixedRequirements) {} + +/// +/// @requirement something_arbitrary +/// +TEST(RequirementTagTest4, InvalidRequirement) {} + +/// +/// @requirement +/// +TEST(RequirementTagTest4, MissingRequirementReference) {} + +/** ensure required-by tags are parsed correctly */ + +/// +/// @requiredby FOO0::BAR0 +/// +TEST(RequirementByTest1, RequiredByWithAt) {} + +/// +/// @requiredby FOO0::BAR0, FOO1::BAR1 +/// +TEST(RequirementByTest1, MultipleRequiredByCommaSeparated) {} + +/** + * @requiredby FOO0::BAR0, FOO1::BAR1, + * FOO2::BAR2 + * @requiredby FOO3::BAR3 FOO4::BAR4, + * FOO5::BAR5 + * @requiredby FOO6::BAR6 FOO7::BAR7 + * FOO8::BAR8 + */ +TEST(RequirementByTest1, MultipleRequiredByAsComments) {} + +/// @test lorem ipsum +/// @requiredby FOO0::BAR0, +/// FOO1::BAR1, +/// FOO2::BAR2, +/// FOO3::BAR3, +/// FOO4::BAR4, +/// FOO5::BAR5, +/// FOO6::BAR6, +/// FOO7::BAR7, +/// FOO8::BAR8 +/// +TEST(RequirementByTest2, RequiredByWithNewLines) {} + +/** ensure testmethods are parsed correctly */ + +/// @testmethods TM_REQUIREMENT +TEST(TestMethodsTagTest, TestMethod) {} + +/** + * @testmethods TM_PAIRWISE TM_BOUNDARY + */ +TEST(TestMethodsTagTest2, TestMethodAsCommentsSpaceSeparated) {} + +/// @testmethods TM_REQUIREMENT, TM_EQUIVALENCE +TEST(TestMethodsTagTest2, TestMethodAsCommentsCommaSeparated) {} + +// /// @testmethods TM_REQUIREMENT, TM_EQUIVALENCE +// /// @testmethods TM_BOUNDARY, TM_CONDITION +// TEST(TestMethodsTagTest2, TestMethodAsCommentsMultipleLines) {} + +/// +/// @testmethods something_arbitrary +/// +TEST(TestMethodsTagTest3, InvalidTestMethod) {} + +/// +/// @testmethods +/// +TEST(TestMethodsTagTest4, MissingTestMethod) {} + +/** ensure version are parsed correctly */ + +/// @version 1 +TEST(VersionTagTest, VersionTagTestInOnline) {} + +/// @version 1, 42 +TEST(VersionTagTest, MultipleVersionTagTestInOnline) {} + +/// @requirement CB-#0815 +/// @version 12, 70 +TEST(VersionTagTest, MoreVersionsThanRequirements) {} + +/// @requirement CB-#0815, CB-#0816 +/// @version 28 +TEST(VersionTagTest, MoreRequirementsThanVersions) {} + +/// @requirement CB-#123 CB-#456 +/// @version 28 99 +TEST(VersionTagTest, VersionSpaceSeparated) {} + +/** ensure everything is parsed correctly at once */ + +/// +/// @test foo +/// @brief this test tests something +/// @version 42, 2 +/// @requirement CB-#0815, CB-#0816 +/// @requiredby FOO0::BAR0 +/// @testmethods TM_BOUNDARY, TM_REQUIREMENT +/// +TEST(AllTogetherTest, ImplementationMultipleLines) { + EXPECT_EQ(true, DummyFunctionForValidCondition()); +} + +/** + * commented test cases + */ +// TEST(LayoutTest1, SingleComment){} +/* TEST(LayoutTest2, InlineComment){} */ +/* + * TEST(LayoutTest2, Comment) {} + */ + +/** + * invalid test cases + * the following tests should not be parsed + * as valid test cases + */ +TEST(InvalidTest1,) {} +TEST(, InvalidTest2) {} +TEST(,) {} +TEST() {} diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 00000000..26d33521 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 00000000..8d2aa05e --- /dev/null +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,30 @@ + + + + \ No newline at end of file diff --git a/.idea/inspectionProfiles/profiles_settings.xml b/.idea/inspectionProfiles/profiles_settings.xml new file mode 100644 index 00000000..105ce2da --- /dev/null +++ b/.idea/inspectionProfiles/profiles_settings.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/.idea/lobster.iml b/.idea/lobster.iml new file mode 100644 index 00000000..0070e873 --- /dev/null +++ b/.idea/lobster.iml @@ -0,0 +1,7 @@ + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 00000000..ef7cb89a --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,7 @@ + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 00000000..35eb1ddf --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/lobster/tools/regex/__init__.py b/lobster/tools/regex/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/lobster/tools/regex/requirements.trlc b/lobster/tools/regex/requirements.trlc new file mode 100644 index 00000000..45f2c63c --- /dev/null +++ b/lobster/tools/regex/requirements.trlc @@ -0,0 +1,83 @@ +package regex_req +import req + +req.Tool_Definition Valid_Config_Path { + title = '''Valid config path given''' + description = ''' + Valid config path means that the tool was called with + an existing [[Config_File_Path]]. + ''' +} + +req.Tool_Definition No_Config_Path { + title = '''No config path given''' + description = ''' + No config path means that the tool was called with nothing specified + as the command line. + ''' +} + +req.Tool_Definition Invalid_Config_Path { + title = '''Invalid path given''' + description = ''' + Invalid config path means that the tool was called with + a non-existent [[Config_File_Path]]. + ''' +} + +req.Tool_Definition Valid_Config_File { + title = '''Valid config file given''' + description = ''' + Valid config file means that the tool was called with + a [[Config_File]]. + ''' +} + +req.Tool_Definition Invalid_Config_File { + title = '''Invalid config file given''' + description = ''' + Invalid config file means that the tool was called with a file + which is not [[Config_File]]. + ''' +} + + +req.Tool_Config_Parameter Config_File { + description = ''' + This Yarn file consists of the configuration of the tool. + The file should consist of the following keys: test_case_names_regex, requirements_regex, output + ''' +} + +req.Tool_Config_Parameter Config_File_Path { + description = ''' + This parameter specifies the path to [[Config_File]] as a command line . + ''' +} + + + +req.System_Requirement Valid_Input_Config { + description = ''' + If [[Valid_Config_Path]] and [[Valid_Config_File]] are specified, the output file/s containing the extracted tests + will be written with user-specific markers to the file specified in [[Config_File]]. + ''' +} + +req.System_Requirement_Else No_Input_Config { + description = ''' + Else if [[No_Config_Path]], the tool shall exit with return code 1. + ''' +} + +req.System_Requirement_Else Invalid_Input_Config_Path { + description = ''' + Else if [[Invalid_Config_Path]], the tool shall exit with return code 1. + ''' +} + +req.System_Requirement_Else Invalid_Input_Config_File { + description = ''' + Else if [[Invalid_Config_File]], the tool shall exit with return code 1. + ''' +} \ No newline at end of file diff --git a/lobster/tools/requirements.rsl b/lobster/tools/requirements.rsl index db0c4230..32e89fdc 100644 --- a/lobster/tools/requirements.rsl +++ b/lobster/tools/requirements.rsl @@ -1,5 +1,21 @@ package req +type Tool_Definition { + title ''' + Title of the definition. + ''' String + description ''' + A definition describes what a particular entity is. + ''' String +} + +type Tool_Config_Parameter { + description ''' + A tool configuration parameter describes the exact way in which the + parameters shall be given for the tool from the user's point of view. + ''' String +} + type System_Requirement { description ''' The content of the requirement. @@ -14,3 +30,10 @@ type Software_Requirement { A software requirement describes the behaviour of a lobster tool. ''' String } + +type System_Requirement_Else { + description ''' + A tool requirement else describes the behavior of a Lobster tool in which the specific conditions + can be applied by the user. + ''' String +} \ No newline at end of file diff --git a/tests-system/lobster-regex/data/test_case.scala b/tests-system/lobster-regex/data/test_case.scala new file mode 100644 index 00000000..64776f19 --- /dev/null +++ b/tests-system/lobster-regex/data/test_case.scala @@ -0,0 +1,72 @@ +/** + * A simple Scala program demonstrating various features like + * case classes, objects, methods, and documentation comments. + */ + +// Define a case class to represent a Person +case class Person(name: String, age: Int) + +/** + * An object to hold utility methods for greeting and age validation. + */ +object Utilities { + + /** + * Generates a greeting message for a person. + * + * @requirement CB-#0815 CB-#0816 + * + * @param person The person to greet. + * @return A greeting string. + */ + def greet(person: Person): String = { + s"Hello, ${person.name}! You are ${person.age} years old." + } + + /** + * Checks if a person is considered an adult. + * + * @requirement CB-#0815, CB-#0816, + * CB-#0817 + * @requirement CB-#0818 CB-#0819 + * CB-#0820 + * + * @param person The person to check. + * @return True if the person is an adult (18 or older), otherwise false. + */ + def isAdult(person: Person): Boolean = { + person.age >= 18 + } +} + +/** + * The main object to run the program. + */ +object Main { + + /** + * The entry point of the application. + * + * @requiredby FOO0::BAR0, FOO1::BAR1, + * FOO2::BAR2 + * @requiredby FOO3::BAR3 FOO4::BAR4, + * FOO5::BAR5 + * @requiredby FOO6::BAR6 FOO7::BAR7 + * FOO8::BAR8 + * + * @param args Command-line arguments (not used in this program). + */ + def main(args: Array[String]): Unit = { + val person = Person("Alice", 25) + + // Generate a greeting + println(Utilities.greet(person)) + + // Check if the person is an adult + if (Utilities.isAdult(person)) { + println(s"${person.name} is an adult.") + } else { + println(s"${person.name} is not an adult.") + } + } +} diff --git a/tests-system/lobster-regex/rbt-valid-input-config/valid-config-file-and-path-scenario/expected-output/exit-code.txt b/tests-system/lobster-regex/rbt-valid-input-config/valid-config-file-and-path-scenario/expected-output/exit-code.txt new file mode 100644 index 00000000..c2270834 --- /dev/null +++ b/tests-system/lobster-regex/rbt-valid-input-config/valid-config-file-and-path-scenario/expected-output/exit-code.txt @@ -0,0 +1 @@ +0 \ No newline at end of file diff --git a/tests-system/lobster-regex/rbt-valid-input-config/valid-config-file-and-path-scenario/expected-output/output.lobster b/tests-system/lobster-regex/rbt-valid-input-config/valid-config-file-and-path-scenario/expected-output/output.lobster new file mode 100644 index 00000000..e6f72048 --- /dev/null +++ b/tests-system/lobster-regex/rbt-valid-input-config/valid-config-file-and-path-scenario/expected-output/output.lobster @@ -0,0 +1,81 @@ +{ + "data": [ + { + "tag": "scala test_case.scala:greet:14", + "location": { + "kind": "file", + "file": "test_case.scala", + "line": 14, + "column": null + }, + "name": "test_case.scala:greet:14", + "messages": [], + "just_up": [], + "just_down": [], + "just_global": [], + "refs": [ + "req 0815", + "req 0816" + ], + "framework": "regex", + "kind": "Function", + "status": null + }, + { + "tag": "scala test_case.scala:isAdult:26", + "location": { + "kind": "file", + "file": "test_case.scala", + "line": 26, + "column": null + }, + "name": "test_case.scala:isAdult:26", + "messages": [], + "just_up": [], + "just_down": [], + "just_global": [], + "refs": [ + "req 0815", + "req 0816", + "req 0817", + "req 0818", + "req 0819", + "req 0820" + ], + "framework": "regex", + "kind": "Function", + "status": null + }, + { + "tag": "scala test_case.scala:main:47", + "location": { + "kind": "file", + "file": "test_case.scala", + "line": 47, + "column": null + }, + "name": "test_case.scala:main:47", + "messages": [], + "just_up": [], + "just_down": [], + "just_global": [], + "refs": [ + "req FOO0::BAR0", + "req FOO1::BAR1", + "req FOO2::BAR2", + "req FOO3::BAR3", + "req FOO4::BAR4", + "req FOO5::BAR5", + "req FOO6::BAR6", + "req FOO7::BAR7", + "req FOO8::BAR8" + ], + "framework": "regex", + "kind": "Function", + "status": null + } + ], + "generator": "lobster-regex", + "schema": "lobster-act-trace", + "version": 3 +} diff --git a/tests-system/lobster-regex/rbt-valid-input-config/valid-config-file-and-path-scenario/expected-output/stderr.txt b/tests-system/lobster-regex/rbt-valid-input-config/valid-config-file-and-path-scenario/expected-output/stderr.txt new file mode 100644 index 00000000..e69de29b diff --git a/tests-system/lobster-regex/rbt-valid-input-config/valid-config-file-and-path-scenario/expected-output/stdout.txt b/tests-system/lobster-regex/rbt-valid-input-config/valid-config-file-and-path-scenario/expected-output/stdout.txt new file mode 100644 index 00000000..50c12e52 --- /dev/null +++ b/tests-system/lobster-regex/rbt-valid-input-config/valid-config-file-and-path-scenario/expected-output/stdout.txt @@ -0,0 +1 @@ +Written 3 lobster items to "output.lobster". \ No newline at end of file diff --git a/tests-system/lobster-regex/rbt-valid-input-config/valid-config-file-and-path-scenario/input/args.txt b/tests-system/lobster-regex/rbt-valid-input-config/valid-config-file-and-path-scenario/input/args.txt new file mode 100644 index 00000000..81e15bf9 --- /dev/null +++ b/tests-system/lobster-regex/rbt-valid-input-config/valid-config-file-and-path-scenario/input/args.txt @@ -0,0 +1 @@ +--config=default_file.yaml \ No newline at end of file diff --git a/tests-system/lobster-regex/rbt-valid-input-config/valid-config-file-and-path-scenario/input/default_file.yaml b/tests-system/lobster-regex/rbt-valid-input-config/valid-config-file-and-path-scenario/input/default_file.yaml new file mode 100644 index 00000000..bf861c53 --- /dev/null +++ b/tests-system/lobster-regex/rbt-valid-input-config/valid-config-file-and-path-scenario/input/default_file.yaml @@ -0,0 +1,18 @@ +files: + - data/test_case.scala +object-name-regex: + - (\\w+[\\s\\t\\n]*)*def[\\s\\t\\n]*((\\w+)|(`(\\w+)`))[\\s\\t\\n]*\\( +requirements_regex: + "@requirement": + - (CB-#\\d+) + "@requiredby": + - (\\w*::\\w+) +docstring_regex: + - /\*\*.*?\*/ +direction: forward +output: + output.lobster: + markers: + - "@requirement" + - "@requiredby" + kind: "req" \ No newline at end of file