Skip to content

Commit c5e81ac

Browse files
Strings: Add tests for Unicode characters that are not in the BMP
1 parent 1f3d5c5 commit c5e81ac

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

src/org/sosy_lab/java_smt/test/StringFormulaManagerTest.java

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,14 @@ private void requireVariableStringLiterals() {
127127
@Test
128128
public void testInputEscape() throws SolverException, InterruptedException {
129129
// Test if SMTLIB Unicode literals are recognized and converted to their Unicode characters.
130-
assertEqual(smgr.length(smgr.makeString("Ξ")), imgr.makeNumber(1));
131130
assertEqual(smgr.length(smgr.makeString("\\u{39E}")), imgr.makeNumber(1));
131+
assertEqual(smgr.length(smgr.makeString("Ξ")), imgr.makeNumber(1));
132+
133+
// Test with a character that is not in the BMP
134+
if (solver != Solvers.PRINCESS) {
135+
String str = Character.toString(0x200cb);
136+
assertEqual(smgr.length(smgr.makeString(str)), imgr.makeNumber(1));
137+
}
132138
}
133139

134140
@Test
@@ -140,6 +146,12 @@ public void testOutputUnescape() throws SolverException, InterruptedException {
140146
assertThat(model.evaluate(smgr.makeString("\\u{39E}"))).isEqualTo("Ξ");
141147
assertThat(model.evaluate(smgr.concat(smgr.makeString("\\u{39E"), smgr.makeString("}"))))
142148
.isEqualTo("\\u{39E}");
149+
150+
// Test with a character that is not in the BMP
151+
if (solver != Solvers.PRINCESS) {
152+
String str = Character.toString(0x200cb);
153+
assertThat(model.evaluate(smgr.makeString(str))).isEqualTo(str);
154+
}
143155
}
144156
}
145157
}

0 commit comments

Comments
 (0)