source: CIVL/examples/library/civlc/seq.cvl

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
RevLine 
[eaf7c65]1#include<civlc.cvh>
2#include<seq.cvh>
3
4int N = 9;
5
6void main(){
7 int a[];
8 int b = 4, c = 5;
9 int length;
10 int t[2];
11
12 $seq_init(&a, 0, NULL);
13 length = $seq_length(&a);
14 $assert(length == 0);
15 $seq_insert(&a, 0, &b, 1);
16 length = $seq_length(&a);
17 $assert(length == 1);
18 $assert(a[0] == b);
19 $seq_init(&a, N, &b);
20 length = $seq_length(&a);
21 $assert(length == N);
22 $seq_insert(&a, 2, &c, 1);
23 length = $seq_length(&a);
24 $assert(length == N + 1);
25 $assert(a[2] == c);
26 $seq_remove(&a, 2, t, 2);
27 length = $seq_length(&a);
28 $assert(length == N - 1);
29 $assert(t[0] == c);
30 $assert(t[1] == b);
31}
Note: See TracBrowser for help on using the repository browser.