2015-12-15 19:18:38 +03:00
|
|
|
#define MEMSIZE 4096*120
|
2015-12-13 16:28:06 +03:00
|
|
|
|
|
|
|
#include "../lib/io.h"
|
|
|
|
#include "../lib/collection.h"
|
|
|
|
|
2015-12-16 19:13:34 +03:00
|
|
|
|
2015-12-13 16:28:06 +03:00
|
|
|
void main()
|
|
|
|
{
|
|
|
|
io.run("/sys/develop/board", "");
|
2015-12-16 19:13:34 +03:00
|
|
|
test1();
|
|
|
|
test2();
|
|
|
|
}
|
|
|
|
|
2016-02-23 17:41:55 +03:00
|
|
|
void test1()
|
|
|
|
collection s;
|
|
|
|
{
|
2015-12-15 19:18:38 +03:00
|
|
|
s.add("Hello");
|
2020-05-06 18:53:34 +03:00
|
|
|
s.add("World");
|
2015-12-16 19:13:34 +03:00
|
|
|
debugln(s.get(0)); //-> Hello
|
|
|
|
debugln(s.get(1)); //-> World
|
2020-05-06 18:53:34 +03:00
|
|
|
s.delete_last();
|
|
|
|
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 19:13:34 +03:00
|
|
|
s.drop();
|
|
|
|
}
|
|
|
|
|
2015-12-16 19:15:37 +03:00
|
|
|
void test2()
|
2016-02-23 17:41:55 +03:00
|
|
|
collection_int ci;
|
|
|
|
int i;
|
|
|
|
{
|
|
|
|
ci.add(0);
|
|
|
|
ci.add(1);
|
|
|
|
ci.add(2);
|
|
|
|
ci.add(3);
|
2020-03-22 22:50:16 +03:00
|
|
|
debugln("-> 0 1 2 3");
|
|
|
|
for (i=0; i<ci.count; i++) debugln(itoa(ci.get(i))); //-> 0 1 2 3
|
2016-02-23 17:41:55 +03:00
|
|
|
ci.count--;
|
|
|
|
ci.count--;
|
|
|
|
ci.add(4);
|
2020-03-22 22:50:16 +03:00
|
|
|
debugln("-> 0 1 4");
|
|
|
|
for (i=0; i<ci.count; i++) debugln(itoa(ci.get(i))); //-> 0 1 4
|
2016-02-23 17:41:55 +03:00
|
|
|
ci.drop();
|
2015-12-13 16:28:06 +03:00
|
|
|
}
|