Skip to content

Commit

Permalink
 added test cases related to classes pattern and matcher
Browse files Browse the repository at this point in the history
Signed-off-by: Lucas Cordeiro <[email protected]>
  • Loading branch information
lucasccordeiro committed Feb 22, 2017
1 parent 0cccfe3 commit be02a80
Show file tree
Hide file tree
Showing 6 changed files with 66 additions and 0 deletions.
Binary file not shown.
25 changes: 25 additions & 0 deletions regression/strings/RegexMatches01/RegexMatches01.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class RegexMatches01
{
public static void main(String[] args)
{
Pattern expression =
Pattern.compile("W.*\\d[0-35-9]-\\d\\d-\\d\\d");

String string1 = "XXXX's Birthday is 05-12-75\n" +
"YYYY's Birthday is 11-04-68\n" +
"ZZZZ's Birthday is 04-28-73\n" +
"WWWW's Birthday is 12-17-77";

Matcher matcher = expression.matcher(string1);

while (matcher.find())
{
System.out.println(matcher.group());
String tmp=matcher.group();
assert tmp.equals("WWWW's Birthday is 12-17-77");
}
}
}
8 changes: 8 additions & 0 deletions regression/strings/RegexMatches01/test.desc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FUTURE
RegexMatches01.class
--string-refine --unwind 100
^EXIT=0$
^SIGNAL=0$
^VERIFICATION SUCCESSFUL$
--
^warning: ignoring
Binary file not shown.
25 changes: 25 additions & 0 deletions regression/strings/RegexMatches02/RegexMatches02.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class RegexMatches02
{
public static void main(String[] args)
{
Pattern expression =
Pattern.compile("W.*\\d[0-35-9]-\\d\\d-\\d\\d");

String string1 = "XXXX's Birthday is 05-12-75\n" +
"YYYY's Birthday is 11-04-68\n" +
"ZZZZ's Birthday is 04-28-73\n" +
"WWWW's Birthday is 12-17-77";

Matcher matcher = expression.matcher(string1);

while (matcher.find())
{
System.out.println(matcher.group());
String tmp=matcher.group();
assert tmp.equals("WWWWW's Birthday is 12-17-77");
}
}
}
8 changes: 8 additions & 0 deletions regression/strings/RegexMatches02/test.desc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FUTURE
RegexMatches02.class
--string-refine --unwind 100
^EXIT=0$
^SIGNAL=0$
^VERIFICATION FAILED$
--
^warning: ignoring

0 comments on commit be02a80

Please sign in to comment.