-
Notifications
You must be signed in to change notification settings - Fork 97
refactor: Enforce arrayRef regex & Handling and XML Spacing Rules #3900
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
arng40
wants to merge
23
commits into
develop
Choose a base branch
from
bugfix/dudes/rtt-sourceflux
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+181
−86
Open
Changes from all commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
abe634c
enforce refArray regex
arng40 e03d340
xsd
arng40 dc6c48f
Merge branch 'develop' into bugfix/dudes/rtt-sourceflux
arng40 b015667
add regex spaces
arng40 d237499
Merge branch 'bugfix/dudes/rtt-sourceflux' of https://github.com/GEOS…
arng40 77c7b3e
uncrustify
arng40 ff77135
fix test
arng40 e8be705
Merge branch 'develop' into bugfix/dudes/rtt-sourceflux
arng40 b89c41a
add & update test
arng40 071b15c
Merge branch 'develop' into bugfix/dudes/rtt-sourceflux
arng40 95710e3
add tests and update validation regex
arng40 f2724e4
add test for refArray
arng40 e53891a
Merge branch 'develop' into bugfix/dudes/rtt-sourceflux
arng40 c5513f4
uncrust
arng40 1a51f53
try to remove std::ws
arng40 05c7ae1
try to trimed
arng40 332370c
uncrustify
arng40 3dafc57
review adressed
arng40 768a9cc
Merge branch 'develop' into bugfix/dudes/rtt-sourceflux
arng40 21a424a
Merge branch 'develop' into bugfix/dudes/rtt-sourceflux
arng40 4a08915
remove useless code & add test for non array
arng40 731d29d
Merge branch 'develop' into bugfix/dudes/rtt-sourceflux
arng40 5d57b45
Merge branch 'develop' into bugfix/dudes/rtt-sourceflux
arng40 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -243,6 +243,9 @@ INSTANTIATE_TEST_SUITE_P( | |
| real64AttributeTests, | ||
| real64AttributeTestFixture, | ||
| ::testing::Values( std::make_tuple( "1", 1, false ), | ||
| std::make_tuple( "1 ", 1, false ), | ||
| std::make_tuple( " 1", 1, false ), | ||
| std::make_tuple( " 1 ", 1, false ), | ||
| std::make_tuple( "-23", -23, false ), | ||
| std::make_tuple( "4.5", 4.5, false ), | ||
| std::make_tuple( "4.", 4.0, false ), | ||
|
|
@@ -260,7 +263,6 @@ INSTANTIATE_TEST_SUITE_P( | |
| std::make_tuple( "1.234gamma", 0, true ), | ||
| std::make_tuple( "1.2.3", 0, true ), | ||
| std::make_tuple( "1e2.3 ", 0, true ), | ||
| std::make_tuple( "1 ", 0, true ), | ||
| std::make_tuple( "1e", 0, true ), | ||
| std::make_tuple( "1e-", 0, true ), | ||
| std::make_tuple( "1e+", 0, true ))); | ||
|
|
@@ -284,6 +286,9 @@ INSTANTIATE_TEST_SUITE_P( | |
| real32AttributeTests, | ||
| real32AttributeTestFixture, | ||
| ::testing::Values( std::make_tuple( "1", 1, false ), | ||
| std::make_tuple( "1 ", 1, false ), | ||
| std::make_tuple( " 1", 1, false ), | ||
| std::make_tuple( " 1 ", 1, false ), | ||
| std::make_tuple( "-23", -23, false ), | ||
| std::make_tuple( "4.5", 4.5, false ), | ||
| std::make_tuple( "4.", 4.0, false ), | ||
|
|
@@ -301,7 +306,6 @@ INSTANTIATE_TEST_SUITE_P( | |
| std::make_tuple( "1.234gamma", 0, true ), | ||
| std::make_tuple( "1.2.3", 0, true ), | ||
| std::make_tuple( "1e2.3 ", 0, true ), | ||
| std::make_tuple( "1 ", 0, true ), | ||
| std::make_tuple( "1e", 0, true ), | ||
MelReyCG marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| std::make_tuple( "1e-", 0, true ), | ||
| std::make_tuple( "1e+", 0, true ))); | ||
|
|
@@ -319,13 +323,15 @@ INSTANTIATE_TEST_SUITE_P( | |
| integerAttributeTests, | ||
| integerAttributeTestFixture, | ||
| ::testing::Values( std::make_tuple( "1", 1, false ), | ||
| std::make_tuple( "1 ", 1, false ), | ||
| std::make_tuple( " 1", 1, false ), | ||
| std::make_tuple( " 1 ", 1, false ), | ||
| std::make_tuple( "-23", -23, false ), | ||
| std::make_tuple( "4.5", 0, true ), | ||
| std::make_tuple( "4.", 0, true ), | ||
| std::make_tuple( "alpha", 0, true ), | ||
| std::make_tuple( "1beta234", 0, true ), | ||
| std::make_tuple( "1234gamma", 0, true ), | ||
| std::make_tuple( "1 ", 0, true ), | ||
| std::make_tuple( "1 2", 0, true ))); | ||
|
|
||
|
|
||
|
|
@@ -374,12 +380,13 @@ TEST( testXmlWrapper, testGroupNamesFormats ) | |
| GroupNameTest( groupNameRegex, "testname01" ), | ||
| GroupNameTest( groupNameRegex, "test_name" ), | ||
| GroupNameTest( groupNameRegex, "test-name" ), | ||
| GroupNameTest( groupNameRegex, "test.name" ), | ||
| GroupNameTest( groupNameRegex, " testname " ), | ||
| GroupNameTest( groupNameRegex, " \t testname \n " ), | ||
| }; | ||
| for( GroupNameTest const & input : workingInputs ) | ||
| { | ||
| EXPECT_NO_THROW( xmlWrapper::stringToInputVariable( groupName, input.m_valueToTest, input.m_regex ) ); | ||
| EXPECT_STREQ( input.m_valueToTest.c_str(), groupName.c_str() ); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Here is the place that needs to be reworked. |
||
| EXPECT_STREQ( groupName.c_str(), groupName.c_str() ); | ||
| } | ||
| } | ||
| { | ||
|
|
@@ -391,13 +398,97 @@ TEST( testXmlWrapper, testGroupNamesFormats ) | |
| //white spaces | ||
| GroupNameTest( groupNameRegex, "test name" ), | ||
| GroupNameTest( groupNameRegex, "test\tname" ), | ||
| GroupNameTest( groupNameRegex, "testname " ), | ||
| GroupNameTest( groupNameRegex, " testname" ), | ||
| //fordbiden characters | ||
| GroupNameTest( groupNameRegex, "test/name" ), | ||
| GroupNameTest( groupNameRegex, "test:name" ), | ||
| GroupNameTest( groupNameRegex, "test;name" ), | ||
| GroupNameTest( groupNameRegex, "test\\name" ), | ||
| GroupNameTest( groupNameRegex, "{[arrayElement]}" ), | ||
| GroupNameTest( groupNameRegex, "{name1,name2,name3}" ), | ||
| }; | ||
| for( GroupNameTest const & input : erroneousInputs ) | ||
| { | ||
| EXPECT_THROW( xmlWrapper::stringToInputVariable( groupName, input.m_valueToTest, input.m_regex ), | ||
| InputError ) << "Parsing input '"<< input.m_valueToTest | ||
| << "' with regex '" << input.m_regex.m_regexStr << "' didn't throw an InputError as expected."; | ||
| } | ||
| } | ||
| } | ||
| TEST( testXmlWrapper, testGroupNamesArrayFormats ) | ||
| { | ||
| struct GroupNameTest | ||
| { | ||
| Regex const & m_regex; | ||
| string m_valueToTest; | ||
| GroupNameTest( Regex const & regex, string_view valueToTest ): | ||
| m_regex( regex ), m_valueToTest( valueToTest ) {} | ||
| }; | ||
|
|
||
| Regex const & groupNameRefArrayRegex = rtTypes::getTypeRegex< string >( rtTypes::CustomTypes::groupNameRefArray ); | ||
| string groupName; | ||
|
|
||
| { | ||
| stdVector< GroupNameTest > workingInputs = { | ||
| GroupNameTest( groupNameRefArrayRegex, "{}" ), | ||
| GroupNameTest( groupNameRefArrayRegex, " {} " ), | ||
| GroupNameTest( groupNameRefArrayRegex, " \t {} \n " ), | ||
| GroupNameTest( groupNameRefArrayRegex, "{groupName}" ), | ||
| GroupNameTest( groupNameRefArrayRegex, "{123name}" ), | ||
| GroupNameTest( groupNameRefArrayRegex, "{name123}" ), | ||
| GroupNameTest( groupNameRefArrayRegex, "{a-Z0-9./*[]-_,}" ), | ||
| GroupNameTest( groupNameRefArrayRegex, "{name.with-special_chars}" ), | ||
| GroupNameTest( groupNameRefArrayRegex, "{path/to/resource*}" ), | ||
| GroupNameTest( groupNameRefArrayRegex, "{[arrayElement]}" ), | ||
MelReyCG marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| GroupNameTest( groupNameRefArrayRegex, "{name1,name2,name3}" ), | ||
| }; | ||
| for( GroupNameTest const & input : workingInputs ) | ||
| { | ||
| EXPECT_NO_THROW( xmlWrapper::stringToInputVariable( groupName, input.m_valueToTest, input.m_regex ) ); | ||
| EXPECT_STREQ( groupName.c_str(), groupName.c_str() ); | ||
| } | ||
| } | ||
| { | ||
| stdVector< GroupNameTest > erroneousInputs = { | ||
| GroupNameTest( groupNameRefArrayRegex, "" ), | ||
| GroupNameTest( groupNameRefArrayRegex, " " ), | ||
| GroupNameTest( groupNameRefArrayRegex, " \t " ), | ||
| GroupNameTest( groupNameRefArrayRegex, "{\t}" ), | ||
| GroupNameTest( groupNameRefArrayRegex, "{test:name}" ), | ||
| GroupNameTest( groupNameRefArrayRegex, "{test;name}" ), | ||
| GroupNameTest( groupNameRefArrayRegex, "{test\\name}" ), | ||
| GroupNameTest( groupNameRefArrayRegex, "{test|name}" ), | ||
| GroupNameTest( groupNameRefArrayRegex, "{test^name}" ), | ||
| GroupNameTest( groupNameRefArrayRegex, "{test$name}" ), | ||
| GroupNameTest( groupNameRefArrayRegex, "{test&name}" ), | ||
| GroupNameTest( groupNameRefArrayRegex, "{test#name}" ), | ||
| GroupNameTest( groupNameRefArrayRegex, "{test!name}" ), | ||
| GroupNameTest( groupNameRefArrayRegex, "{test%name}" ), | ||
| GroupNameTest( groupNameRefArrayRegex, "{test@name}" ), | ||
| GroupNameTest( groupNameRefArrayRegex, "{test(name}" ), | ||
| GroupNameTest( groupNameRefArrayRegex, "{test)name}" ), | ||
| GroupNameTest( groupNameRefArrayRegex, "{test=name}" ), | ||
| GroupNameTest( groupNameRefArrayRegex, "{test+name}" ), | ||
| GroupNameTest( groupNameRefArrayRegex, "{test<name}" ), | ||
| GroupNameTest( groupNameRefArrayRegex, "{test>name}" ), | ||
| GroupNameTest( groupNameRefArrayRegex, "{test\tname}" ), | ||
| GroupNameTest( groupNameRefArrayRegex, "{test\nname}" ), | ||
| GroupNameTest( groupNameRefArrayRegex, "{test\rname}" ), | ||
| GroupNameTest( groupNameRefArrayRegex, "groupName" ), | ||
| GroupNameTest( groupNameRefArrayRegex, "{groupName" ), | ||
| GroupNameTest( groupNameRefArrayRegex, "groupName}" ), | ||
| GroupNameTest( groupNameRefArrayRegex, "{groupName}} " ), | ||
| GroupNameTest( groupNameRefArrayRegex, "{}groupName" ), | ||
| GroupNameTest( groupNameRefArrayRegex, "groupName{}" ), | ||
| GroupNameTest( groupNameRefArrayRegex, "{hello, \t\n\r ,world}" ), | ||
| GroupNameTest( groupNameRefArrayRegex, "test{groupName}" ), | ||
| GroupNameTest( groupNameRefArrayRegex, "{groupName}test" ), | ||
| GroupNameTest( groupNameRefArrayRegex, "{groupName} test" ), | ||
| GroupNameTest( groupNameRefArrayRegex, "{element with space, another}" ), | ||
| GroupNameTest( groupNameRefArrayRegex, "{element, element with space, 123.456, a-b}" ), | ||
| GroupNameTest( groupNameRefArrayRegex, "{ space at ends } " ), | ||
| GroupNameTest( groupNameRefArrayRegex, "{valuewith,,commas }" ), | ||
MelReyCG marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| GroupNameTest( groupNameRefArrayRegex, "{ value with , commas }" ), | ||
| GroupNameTest( groupNameRefArrayRegex, "{{groupname}}" ), | ||
| }; | ||
| for( GroupNameTest const & input : erroneousInputs ) | ||
| { | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.