mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-09-22 21:55:39 +00:00
clean up Expedition parsing regexp;
see https://github.com/SAP/sailing-analytics/security/code-scanning/114
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package com.sap.sse.test;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
@@ -65,4 +66,14 @@ public class RegexTest {
|
||||
logger.info("Escaped value: "+escaped);
|
||||
assertEquals("\"abc\\\\\\'\\\"\\\\\\\"\"", escaped);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNonExponentialExpeditionPattern() {
|
||||
final Pattern completeLinePattern = Pattern
|
||||
.compile("#([0-9]*)((,([0-9][0-9]*),(-?[0-9]*(\\.[0-9]*)?))*)\\*X?([0-9a-fA-F][0-9a-fA-F]*)");
|
||||
final Matcher m1 = completeLinePattern.matcher("#,0,,0,,0,,0,,0,,0,,0,,0,,0,,0,,0,,0,,0,,0,,0,,0,X");
|
||||
assertFalse(m1.matches());
|
||||
final Matcher m2 = completeLinePattern.matcher("#,0,,0,,0,,0,,0,,0,,0,,0,,0,,0,,0,,0,,0,,0,,0,,0,*35");
|
||||
assertTrue(m2.matches());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user