This source file includes following definitions.
- value_at
- main
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 #include <config.h>
20
21 #define DYNARRAY_STRUCT int_sequence
22 #define DYNARRAY_ELEMENT int
23 #define DYNARRAY_PREFIX intseq_
24 #include "dynarray.h"
25
26 #include "macros.h"
27
28 #define N 100000
29
30 static int
31 value_at (long long int i)
32 {
33 return (i % 13) + ((i * i) % 251);
34 }
35
36 int
37 main ()
38 {
39 struct int_sequence s;
40 int i;
41
42 intseq_init (&s);
43 for (i = 0; i < N; i++)
44 intseq_add (&s, value_at (i));
45 for (i = N - 1; i >= N / 2; i--)
46 {
47 ASSERT (* intseq_at (&s, i) == value_at (i));
48 intseq_remove_last (&s);
49 }
50 intseq_free (&s);
51
52 return 0;
53 }