File tree 6 files changed +144
-0
lines changed
regression/snapshot-harness
6 files changed +144
-0
lines changed Original file line number Diff line number Diff line change
1
+ #include <assert.h>
2
+
3
+ int foo (int i )
4
+ {
5
+ return i + 1 ;
6
+ }
7
+
8
+ int (* fun_ptr )(int );
9
+
10
+ void initialize ()
11
+ {
12
+ fun_ptr = & foo ;
13
+ }
14
+
15
+ void checkpoint ()
16
+ {
17
+ }
18
+
19
+ int main ()
20
+ {
21
+ initialize ();
22
+ checkpoint ();
23
+
24
+ assert (fun_ptr == & foo );
25
+ assert ((* fun_ptr )(5 ) == 6 );
26
+ assert ((* fun_ptr )(5 ) == foo (5 ));
27
+ return 0 ;
28
+ }
Original file line number Diff line number Diff line change
1
+ CORE
2
+ main.c
3
+ fun_ptr --harness-type initialise-with-memory-snapshot --initial-goto-location main:4
4
+ ^EXIT=0$
5
+ ^SIGNAL=0$
6
+ \[main.assertion.1\] line [0-9]+ assertion fun_ptr == \&foo: SUCCESS
7
+ \[main.assertion.2\] line [0-9]+ assertion \(\*fun_ptr\)\(5\) == 6: SUCCESS
8
+ \[main.assertion.3\] line [0-9]+ assertion \(\*fun_ptr\)\(5\) == foo\(5\): SUCCESS
9
+ VERIFICATION SUCCESSFUL
10
+ --
11
+ ^warning: ignoring
Original file line number Diff line number Diff line change
1
+ #include <assert.h>
2
+
3
+ int plus (int i )
4
+ {
5
+ return i + 1 ;
6
+ }
7
+
8
+ int minus (int i )
9
+ {
10
+ return i - 1 ;
11
+ }
12
+
13
+ int (* fun_ptr1 )(int );
14
+ int (* fun_ptr2 )(int );
15
+
16
+ void initialize ()
17
+ {
18
+ fun_ptr1 = & plus ;
19
+ fun_ptr2 = & minus ;
20
+ }
21
+
22
+ void checkpoint ()
23
+ {
24
+ }
25
+
26
+ int main ()
27
+ {
28
+ initialize ();
29
+ checkpoint ();
30
+
31
+ assert (fun_ptr1 == & plus );
32
+ assert ((* fun_ptr1 )(5 ) == 6 );
33
+ assert ((* fun_ptr1 )(5 ) == plus (5 ));
34
+ assert (fun_ptr2 != fun_ptr1 );
35
+ assert ((* fun_ptr2 )(5 ) == 4 );
36
+ return 0 ;
37
+ }
Original file line number Diff line number Diff line change
1
+ CORE
2
+ main.c
3
+ fun_ptr1,fun_ptr2 --harness-type initialise-with-memory-snapshot --initial-goto-location main:4
4
+ ^EXIT=0$
5
+ ^SIGNAL=0$
6
+ \[main.assertion.1\] line [0-9]+ assertion fun_ptr1 == \&plus: SUCCESS
7
+ \[main.assertion.2\] line [0-9]+ assertion \(\*fun_ptr1\)\(5\) == 6: SUCCESS
8
+ \[main.assertion.3\] line [0-9]+ assertion \(\*fun_ptr1\)\(5\) == plus\(5\): SUCCESS
9
+ \[main.assertion.4\] line [0-9]+ assertion fun_ptr2 \!= fun_ptr1: SUCCESS
10
+ \[main.assertion.5\] line [0-9]+ assertion \(\*fun_ptr2\)\(5\) == 4: SUCCESS
11
+ VERIFICATION SUCCESSFUL
12
+ --
13
+ ^warning: ignoring
Original file line number Diff line number Diff line change
1
+ #include <assert.h>
2
+
3
+ int plus (int i )
4
+ {
5
+ return i + 1 ;
6
+ }
7
+
8
+ int minus (int i )
9
+ {
10
+ return i - 1 ;
11
+ }
12
+
13
+ typedef int (* fun_ptrt )(int );
14
+ fun_ptrt fun_array [2 ];
15
+
16
+ fun_ptrt fun_ptr1 ;
17
+ fun_ptrt fun_ptr2 ;
18
+
19
+ void initialize ()
20
+ {
21
+ fun_array [0 ] = & plus ;
22
+ fun_array [1 ] = & minus ;
23
+ fun_ptr1 = * fun_array ;
24
+ fun_ptr2 = fun_array [1 ];
25
+ }
26
+
27
+ void checkpoint ()
28
+ {
29
+ }
30
+
31
+ int main ()
32
+ {
33
+ initialize ();
34
+ checkpoint ();
35
+
36
+ assert (fun_ptr1 == & plus );
37
+ assert ((* fun_ptr1 )(5 ) == 6 );
38
+ assert ((* fun_ptr1 )(5 ) == plus (5 ));
39
+ assert (fun_ptr2 != fun_ptr1 );
40
+ assert ((* fun_ptr2 )(5 ) == 4 );
41
+ return 0 ;
42
+ }
Original file line number Diff line number Diff line change
1
+ CORE
2
+ main.c
3
+ fun_array,fun_ptr1,fun_ptr2 --harness-type initialise-with-memory-snapshot --initial-goto-location main:4
4
+ ^EXIT=0$
5
+ ^SIGNAL=0$
6
+ \[main.assertion.1\] line [0-9]+ assertion fun_ptr1 == \&plus: SUCCESS
7
+ \[main.assertion.2\] line [0-9]+ assertion \(\*fun_ptr1\)\(5\) == 6: SUCCESS
8
+ \[main.assertion.3\] line [0-9]+ assertion \(\*fun_ptr1\)\(5\) == plus\(5\): SUCCESS
9
+ \[main.assertion.4\] line [0-9]+ assertion fun_ptr2 \!= fun_ptr1: SUCCESS
10
+ \[main.assertion.5\] line [0-9]+ assertion \(\*fun_ptr2\)\(5\) == 4: SUCCESS
11
+ VERIFICATION SUCCESSFUL
12
+ --
13
+ ^warning: ignoring
You can’t perform that action at this time.
0 commit comments