@@ -107,18 +107,15 @@ public void testStringConcatenation()
107
107
public void testStringConcatenationWithValues ()
108
108
throws IOException , SolverException , InterruptedException , InvalidConfigurationException {
109
109
requireStrings ();
110
- String x =
111
- "(declare-const d String)\n "
112
- + "(assert (= d (str.++ \" a\" \" b\" \" c\" )))\n " ;
110
+ String x = "(declare-const d String)\n " + "(assert (= d (str.++ \" a\" \" b\" \" c\" )))\n " ;
113
111
114
112
BooleanFormula actualResult = mgr .universalParseFromString (x );
115
113
StringFormula a = smgr .makeString ("a" );
116
114
StringFormula b = smgr .makeString ("b" );
117
115
StringFormula c = smgr .makeString ("c" );
118
116
StringFormula d = smgr .makeVariable ("d" );
119
117
120
-
121
- BooleanFormula constraint = smgr .equal (d , smgr .concat (a ,b ,c ));
118
+ BooleanFormula constraint = smgr .equal (d , smgr .concat (a , b , c ));
122
119
123
120
assertThat (actualResult ).isEqualTo (constraint );
124
121
}
@@ -253,8 +250,9 @@ public void testRegexInRe()
253
250
RegexFormula regex = smgr .concat (smgr .makeRegex ("a" ), smgr .makeRegex ("b" ));
254
251
BooleanFormula regexMatch = smgr .in (a , regex );
255
252
256
- assertThat (actualResult .equals ("(str.in_re a (re.++ (str.to_re \" \\ Qa\\ E\" ) (str.to_re "
257
- + "\" \\ Qb\\ E\" )))" ));
253
+ assertThat (
254
+ actualResult .equals (
255
+ "(str.in_re a (re.++ (str.to_re \" \\ Qa\\ E\" ) (str.to_re " + "\" \\ Qb\\ E\" )))" ));
258
256
}
259
257
260
258
@ Test
@@ -299,8 +297,9 @@ public void testRegexConcat()
299
297
RegexFormula regex = smgr .concat (smgr .makeRegex ("a" ), smgr .makeRegex ("b" ));
300
298
BooleanFormula regexMatch = smgr .in (a , regex );
301
299
302
- assertThat (actualResult .equals ("(str.in_re a (re.++ (str.to_re \" \\ Qa\\ E\" ) (str.to_re "
303
- + "\" \\ Qb\\ E\" )))" ));
300
+ assertThat (
301
+ actualResult .equals (
302
+ "(str.in_re a (re.++ (str.to_re \" \\ Qa\\ E\" ) (str.to_re " + "\" \\ Qb\\ E\" )))" ));
304
303
}
305
304
306
305
@ Test
@@ -313,7 +312,9 @@ public void testRegexUnion()
313
312
314
313
BooleanFormula actualResult = mgr .universalParseFromString (x );
315
314
316
- assertThat (actualResult .equals ("(str.in_re a (re.union (str.to_re \" \\ Qa\\ E\" ) (str.to_re \" \\ Qb\\ E\" )))" ));
315
+ assertThat (
316
+ actualResult .equals (
317
+ "(str.in_re a (re.union (str.to_re \" \\ Qa\\ E\" ) (str.to_re \" \\ Qb\\ E\" )))" ));
317
318
}
318
319
319
320
@ Test
@@ -359,8 +360,9 @@ public void testRegexIntersection()
359
360
RegexFormula regex = smgr .intersection (smgr .makeRegex ("a" ), smgr .makeRegex ("b" ));
360
361
BooleanFormula regexMatch = smgr .in (a , regex );
361
362
362
- assertThat (actualResult .equals ("(str.in_re a (re.inter (str.to_re \" \\ Qa\\ E\" ) (str.to_re "
363
- + "\" \\ Qb\\ E\" )))" ));
363
+ assertThat (
364
+ actualResult .equals (
365
+ "(str.in_re a (re.inter (str.to_re \" \\ Qa\\ E\" ) (str.to_re " + "\" \\ Qb\\ E\" )))" ));
364
366
}
365
367
366
368
@ Test
@@ -387,8 +389,10 @@ public void testRegexDifference()
387
389
+ "(assert (str.in_re a (re.diff (str.to_re \" a\" ) (str.to_re \" b\" ))))\n " ;
388
390
389
391
BooleanFormula actualResult = mgr .universalParseFromString (x );
390
- assertThat (actualResult .equals ("(str.in_re a (re.inter (str.to_re \" \\ Qa\\ E\" ) (re.comp (str"
391
- + ".to_re \" \\ Qb\\ E\" ))))" ));
392
+ assertThat (
393
+ actualResult .equals (
394
+ "(str.in_re a (re.inter (str.to_re \" \\ Qa\\ E\" ) (re.comp (str"
395
+ + ".to_re \" \\ Qb\\ E\" ))))" ));
392
396
}
393
397
394
398
@ Test
@@ -398,7 +402,9 @@ public void testRegexCross()
398
402
String x = "(declare-const a String)\n " + "(assert (str.in_re a (re.+ (str.to_re \" a\" ))))\n " ;
399
403
400
404
BooleanFormula actualResult = mgr .universalParseFromString (x );
401
- assertThat (actualResult .equals ("(str.in_re a (re.++ (str.to_re \" \\ Qa\\ E\" ) (re.* (str.to_re \" \\ Qa\\ E\" ))))" ));
405
+ assertThat (
406
+ actualResult .equals (
407
+ "(str.in_re a (re.++ (str.to_re \" \\ Qa\\ E\" ) (re.* (str.to_re \" \\ Qa\\ E\" ))))" ));
402
408
}
403
409
404
410
@ Test
@@ -408,8 +414,9 @@ public void testRegexOptional()
408
414
String x = "(declare-const a String)\n " + "(assert (str.in_re a (re.opt (str.to_re \" a\" ))))\n " ;
409
415
410
416
BooleanFormula actualResult = mgr .universalParseFromString (x );
411
- assertThat (actualResult .equals ("(str.in_re a (re.++ (str.to_re \" \\ Qa\\ E\" ) (re.* (str.to_re "
412
- + "\" \\ Qa\\ E\" )))))" ));
417
+ assertThat (
418
+ actualResult .equals (
419
+ "(str.in_re a (re.++ (str.to_re \" \\ Qa\\ E\" ) (re.* (str.to_re " + "\" \\ Qa\\ E\" )))))" ));
413
420
}
414
421
415
422
@ Test
@@ -485,28 +492,30 @@ public void testDeclareUFString()
485
492
@ Test
486
493
public void testComplexStringRegex ()
487
494
throws IOException , SolverException , InterruptedException , InvalidConfigurationException {
488
- String x = "(declare-const X String)\n "
489
- + "(assert (not (str.in_re X (re.++ (str.to_re \" /filename=\" ) (re.* (re.comp (str.to_re \" \\ u{a}\" ))) (str.to_re \" .otf/i\\ u{a}\" )))))\n "
490
- + "(assert (str.in_re X (re.++ (str.to_re \" /filename=\" ) (re.* (re.comp (str.to_re \" \\ u{a}\" ))) (str.to_re \" .xlw/i\\ u{a}\" ))))\n "
491
- + "(check-sat)" ;
495
+ String x =
496
+ "(declare-const X String)\n "
497
+ + "(assert (not (str.in_re X (re.++ (str.to_re \" /filename=\" ) (re.* (re.comp"
498
+ + " (str.to_re \" \\ u{a}\" ))) (str.to_re \" .otf/i\\ u{a}\" )))))\n "
499
+ + "(assert (str.in_re X (re.++ (str.to_re \" /filename=\" ) (re.* (re.comp (str.to_re"
500
+ + " \" \\ u{a}\" ))) (str.to_re \" .xlw/i\\ u{a}\" ))))\n "
501
+ + "(check-sat)" ;
492
502
parseGenerateReparseAndCheckSat (x , false );
493
503
}
494
504
495
505
private void parseGenerateReparseAndCheckSat (String pX , boolean isUnsat )
496
506
throws IOException , SolverException , InterruptedException , InvalidConfigurationException {
497
507
BooleanFormula parse = mgr .universalParseFromString (pX );
498
- System .out .println (parse + "\n --------\n " );
508
+ System .out .println (parse + "\n --------\n " );
499
509
Generator .assembleConstraint (parse );
500
510
String reparsed = Generator .getSMTLIB2String ();
501
511
System .out .println (reparsed );
502
512
BooleanFormula result = mgr .universalParseFromString (reparsed );
503
513
ProverEnvironment proverEnvironment = context .newProverEnvironment ();
504
514
proverEnvironment .addConstraint (result );
505
- if (isUnsat ) {
515
+ if (isUnsat ) {
506
516
assertThat (proverEnvironment .isUnsat ()).isTrue ();
507
- }else {
517
+ } else {
508
518
assertThat (proverEnvironment .isUnsat ()).isFalse ();
509
519
}
510
-
511
520
}
512
521
}
0 commit comments