2015-12-15 17:18:38 +01:00
|
|
|
#define MEMSIZE 4096*120
|
2015-12-13 14:28:06 +01:00
|
|
|
|
|
|
|
#include "../lib/io.h"
|
|
|
|
#include "../lib/collection.h"
|
|
|
|
|
2015-12-16 17:13:34 +01:00
|
|
|
|
2015-12-13 14:28:06 +01:00
|
|
|
void main()
|
|
|
|
{
|
|
|
|
io.run("/sys/develop/board", "");
|
2020-05-23 13:26:58 +02:00
|
|
|
test_int();
|
|
|
|
test_str();
|
|
|
|
ExitProcess();
|
2015-12-16 17:13:34 +01:00
|
|
|
}
|
|
|
|
|
2020-05-23 13:26:58 +02:00
|
|
|
void test_int()
|
|
|
|
collection_int ci=0;
|
|
|
|
int i;
|
|
|
|
{
|
|
|
|
ci.add(0);
|
|
|
|
ci.add(1);
|
|
|
|
ci.add(2);
|
|
|
|
ci.add(3);
|
|
|
|
debugln("-> 0 1 2 3");
|
|
|
|
for (i=0; i<ci.count; i++) debugln(itoa(ci.get(i)));
|
|
|
|
ci.pop();
|
|
|
|
ci.pop();
|
|
|
|
ci.add(4);
|
|
|
|
debugln("-> 0 1 4");
|
|
|
|
for (i=0; i<ci.count; i++) debugln(itoa(ci.get(i)));
|
|
|
|
|
|
|
|
ci.set(1,9);
|
|
|
|
debugln("-> 0 9 4");
|
|
|
|
for (i=0; i<ci.count; i++) debugln(itoa(ci.get(i)));
|
|
|
|
|
|
|
|
ci.set(6,6);
|
|
|
|
debugln("-> 0 9 4 0 0 0 6");
|
|
|
|
for (i=0; i<ci.count; i++) debugln(itoa(ci.get(i)));
|
|
|
|
|
|
|
|
ci.swap(0,2);
|
|
|
|
debugln("-> 4 9 0 0 0 0 6");
|
|
|
|
for (i=0; i<ci.count; i++) debugln(itoa(ci.get(i)));
|
|
|
|
}
|
|
|
|
|
|
|
|
void test_str()
|
|
|
|
collection s=0;
|
2016-02-23 15:41:55 +01:00
|
|
|
{
|
2015-12-15 17:18:38 +01:00
|
|
|
s.add("Hello");
|
2020-05-06 17:53:34 +02:00
|
|
|
s.add("World");
|
2015-12-16 17:13:34 +01:00
|
|
|
debugln(s.get(0)); //-> Hello
|
|
|
|
debugln(s.get(1)); //-> World
|
2020-05-07 12:09:29 +02:00
|
|
|
s.pop();
|
2020-05-06 17:53:34 +02:00
|
|
|
debugln(s.get(0)); //-> Hello
|
|
|
|
debugln(s.get(1)); //-> 0
|
|
|
|
s.add("Kolibri");
|
|
|
|
debugln(s.get(0)); //-> Hello
|
|
|
|
debugln(s.get(1)); //-> Kolibri
|
2015-12-16 17:13:34 +01:00
|
|
|
s.drop();
|
|
|
|
}
|