Rev 7887 | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
5965 | leency | 1 | #define MEMSIZE 4096*120 |
5959 | leency | 2 | |
3 | #include "../lib/io.h" |
||
4 | #include "../lib/collection.h" |
||
5 | |||
5974 | leency | 6 | |
5959 | leency | 7 | void main() |
8 | { |
||
9 | io.run("/sys/develop/board", ""); |
||
7972 | leency | 10 | test_int(); |
11 | test_str(); |
||
12 | ExitProcess(); |
||
5974 | leency | 13 | } |
14 | |||
7972 | leency | 15 | void test_int() |
16 | collection_int ci=0; |
||
17 | int i; |
||
18 | { |
||
19 | ci.add(0); |
||
20 | ci.add(1); |
||
21 | ci.add(2); |
||
22 | ci.add(3); |
||
23 | debugln("-> 0 1 2 3"); |
||
24 | for (i=0; i |
||
25 | ci.pop(); |
||
26 | ci.pop(); |
||
27 | ci.add(4); |
||
28 | debugln("-> 0 1 4"); |
||
29 | for (i=0; i |
||
30 | |||
31 | ci.set(1,9); |
||
32 | debugln("-> 0 9 4"); |
||
33 | for (i=0; i |
||
34 | |||
35 | ci.set(6,6); |
||
36 | debugln("-> 0 9 4 0 0 0 6"); |
||
37 | for (i=0; i |
||
38 | |||
39 | ci.swap(0,2); |
||
40 | debugln("-> 4 9 0 0 0 0 6"); |
||
41 | for (i=0; i |
||
42 | } |
||
43 | |||
44 | void test_str() |
||
45 | collection s=0; |
||
6285 | leency | 46 | { |
5965 | leency | 47 | s.add("Hello"); |
7878 | leency | 48 | s.add("World"); |
5974 | leency | 49 | debugln(s.get(0)); //-> Hello |
50 | debugln(s.get(1)); //-> World |
||
7887 | leency | 51 | s.pop(); |
7878 | leency | 52 | debugln(s.get(0)); //-> Hello |
53 | debugln(s.get(1)); //-> 0 |
||
54 | s.add("Kolibri"); |
||
55 | debugln(s.get(0)); //-> Hello |
||
56 | debugln(s.get(1)); //-> Kolibri |
||
5965 | leency | 57 | s.drop(); |
5974 | leency | 58 | } |