main
|
Last change
on this file was ea777aa, checked in by Alex Wilton <awilton@…>, 3 years ago |
|
Moved examples, include, build_default.properties, common.xml, and README out from dev.civl.com into the root of the repo.
git-svn-id: svn://vsl.cis.udel.edu/civl/trunk@5704 fb995dde-84ed-4084-dfe6-e5aef3e2452c
|
-
Property mode
set to
100644
|
|
File size:
618 bytes
|
| Rev | Line | |
|---|
| [cb11d98] | 1 | #include<civlc.cvh>
|
|---|
| 2 | #include<seq.cvh>
|
|---|
| 3 |
|
|---|
| 4 | int N = 9;
|
|---|
| 5 |
|
|---|
| 6 | void main(){
|
|---|
| 7 | int a[];
|
|---|
| 8 | int b = 4, c = 5;
|
|---|
| 9 | int length;
|
|---|
| 10 | int t[2];
|
|---|
| [ca6d19e] | 11 |
|
|---|
| 12 | $seq_init(&a, 0, NULL);
|
|---|
| 13 | length = $seq_length(&a);
|
|---|
| [d980649] | 14 | $assert(length == 0);
|
|---|
| [ca6d19e] | 15 | $seq_insert(&a, 0, &b, 1);
|
|---|
| 16 | length = $seq_length(&a);
|
|---|
| [d980649] | 17 | $assert(length == 1);
|
|---|
| 18 | $assert(a[0] == b);
|
|---|
| [cb11d98] | 19 | $seq_init(&a, N, &b);
|
|---|
| 20 | length = $seq_length(&a);
|
|---|
| [d980649] | 21 | $assert(length == N);
|
|---|
| [cb11d98] | 22 | $seq_insert(&a, 2, &c, 1);
|
|---|
| 23 | length = $seq_length(&a);
|
|---|
| [d980649] | 24 | $assert(length == N + 1);
|
|---|
| 25 | $assert(a[2] == c);
|
|---|
| [cb11d98] | 26 | $seq_remove(&a, 2, t, 2);
|
|---|
| 27 | length = $seq_length(&a);
|
|---|
| [d980649] | 28 | $assert(length == N - 1);
|
|---|
| 29 | $assert(t[0] == c);
|
|---|
| 30 | $assert(t[1] == b);
|
|---|
| [cb11d98] | 31 | }
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.