-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b61aee0
commit 5976f94
Showing
9 changed files
with
70 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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 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
31 changes: 31 additions & 0 deletions
31
lisa/lisa-analyses/src/test/java/it/unive/lisa/analysis/string/tarsis/TrimTest.java
This file contains 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 |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package it.unive.lisa.analysis.string.tarsis; | ||
|
||
import static org.junit.Assert.assertTrue; | ||
|
||
import org.junit.Test; | ||
|
||
import it.unive.lisa.util.numeric.MathNumberConversionException; | ||
|
||
public class TrimTest { | ||
|
||
@Test | ||
public void repeatSingleString() throws MathNumberConversionException { | ||
RegexAutomaton abc = RegexAutomaton.string("abc"); | ||
RegexAutomaton ws = RegexAutomaton.string(" "); | ||
RegexAutomaton epsilon = RegexAutomaton.string(""); | ||
RegexAutomaton abc_with_ws = RegexAutomaton.string(" a b c "); | ||
|
||
Tarsis a = new Tarsis(abc); | ||
Tarsis b = new Tarsis(ws); | ||
Tarsis c = new Tarsis(abc_with_ws); | ||
|
||
// "abc".trim() = "abc" | ||
assertTrue(a.trim().getAutomaton().isEqualTo(abc)); | ||
|
||
// " ".trim() = "" | ||
assertTrue(b.trim().getAutomaton().isEqualTo(epsilon)); | ||
|
||
// " a b c ".trim() = "a b c" | ||
assertTrue(c.trim().getAutomaton().isEqualTo(RegexAutomaton.string("a b c"))); | ||
} | ||
} |
This file contains 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 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 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 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 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 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