File tree 5 files changed +80
-0
lines changed
jbmc/regression/jbmc-strings/StringToUpperCase
5 files changed +80
-0
lines changed Original file line number Diff line number Diff line change
1
+ public class Test {
2
+ public String det ()
3
+ {
4
+ StringBuilder builder = new StringBuilder ();
5
+ builder .append ("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" .toLowerCase ());
6
+ builder .append ("abcdeghijklmnopfrstuqwxyzABCDvFGHIJKLMENOPQRSTUVWXYZ" .toUpperCase ());
7
+ builder .append ("abcdeghijlmnopqrstvwxyzABCDEFGHIJuKLMNOPQRSfkTUVWXYZ" .toUpperCase ());
8
+ builder .append ("acdefghijklmnopqrsuvwxyzABCDEFbGHIJKLMNOPtQRSTUVWXYZ" .toUpperCase ());
9
+ builder .append ("abcdfghijklmnopqrstuvwxyzABCDEFGHIJeKLMNOPQRSTUVWXYZ" .toUpperCase ());
10
+ return builder .toString ();
11
+ }
12
+
13
+ public String nonDet (String s )
14
+ {
15
+ if (s .length () < 20 )
16
+ return "Short string" ;
17
+ if (!s .startsWith ("A" ))
18
+ return "String not starting with A" ;
19
+
20
+ StringBuilder builder = new StringBuilder ();
21
+ builder .append (s .toUpperCase ());
22
+ builder .append (s .toUpperCase ());
23
+ builder .append (":" );
24
+ builder .append (s );
25
+ builder .append (":" );
26
+ builder .append (s .toUpperCase ());
27
+ builder .append (s .toUpperCase ());
28
+ return builder .toString ();
29
+ }
30
+
31
+ public String withDependency (String s , boolean b )
32
+ {
33
+ // Filter
34
+ if (s == null || s .length () < 20 )
35
+ return "Short string" ;
36
+ if (!s .endsWith ("A" ))
37
+ return "String not ending with A" ;
38
+
39
+ // Act
40
+ String result = s + s .toUpperCase ();
41
+
42
+ // Assert
43
+ if (b ) {
44
+ assert (result .endsWith ("a" ));
45
+ } else {
46
+ assert (!result .endsWith ("a" ));
47
+ }
48
+ return result ;
49
+ }
50
+ }
Original file line number Diff line number Diff line change
1
+ CORE
2
+ Test.class
3
+ --function Test.withDependency --verbosity 10 --max-nondet-string-length 10000
4
+ ^EXIT=10$
5
+ ^SIGNAL=0$
6
+ assertion at file Test.java line 44 .*: SUCCESS
7
+ assertion at file Test.java line 46 .*: FAILURE
8
+ --
9
+ --
10
+ Check that when there are dependency, axioms are added correctly.
Original file line number Diff line number Diff line change
1
+ CORE
2
+ Test.class
3
+ --function Test.det --verbosity 10 --cover location
4
+ ^EXIT=0$
5
+ ^SIGNAL=0$
6
+ coverage.* file Test.java line 9 .*: SATISFIED
7
+ --
8
+ adding lemma .*nondet_infinite_array
9
+ --
10
+ Check that using the string dependence informations, no lemma involving arrays is added
Original file line number Diff line number Diff line change
1
+ CORE
2
+ Test.class
3
+ --function Test.nonDet --verbosity 10 --cover location --max-nondet-string-length 1000
4
+ ^EXIT=0$
5
+ ^SIGNAL=0$
6
+ coverage.* file Test.java line 27 .*: SATISFIED
7
+ --
8
+ adding lemma .*nondet_infinite_array
9
+ --
10
+ Check that using the string dependence informations, no lemma involving arrays is added
You can’t perform that action at this time.
0 commit comments