summaryrefslogtreecommitdiffstats
path: root/tests/spin.c
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2012-05-31 16:39:14 +0200
committerJérémy Zurcher <jeremy@asynk.ch>2012-05-31 16:39:14 +0200
commit4bc1b68caf1165222b7ea4080144547d388d17eb (patch)
treef54132649202d1acfb11730d0dce9d648f5b1efa /tests/spin.c
parente6a53fa2a651ec15b5a2b7c5ed70af421660ca7a (diff)
downloadedoors-4bc1b68caf1165222b7ea4080144547d388d17eb.zip
edoors-4bc1b68caf1165222b7ea4080144547d388d17eb.tar.gz
split and complete tests
Diffstat (limited to 'tests/spin.c')
-rw-r--r--tests/spin.c46
1 files changed, 46 insertions, 0 deletions
diff --git a/tests/spin.c b/tests/spin.c
new file mode 100644
index 0000000..5f80a21
--- /dev/null
+++ b/tests/spin.c
@@ -0,0 +1,46 @@
+
+#include "helper.h"
+
+void test_spin()
+{
+ int i;
+ Eiotas_Particle *p0, *p1, *p2;
+
+ /* add spin */
+ Eiotas_Spin *dom0 = eiotas_spin_add("dom0",10);
+ eiotas_iota_show((Eiotas_Iota*)dom0);
+
+ /* particle require/release */
+ p0 = eiotas_spin_require_particle(dom0);
+ p1 = eiotas_spin_require_particle(dom0);
+
+ eiotas_spin_release_particle(dom0,p0);
+ eiotas_spin_release_particle(dom0,p1);
+ p2 = eiotas_spin_require_particle(dom0);
+ check_cond((p2==p1),"Particle require fail\n");
+
+ eiotas_release_particle(dom0,p2);
+
+ /* particle send(sys) */
+ p0 = eiotas_spin_require_particle(dom0);
+ p1 = eiotas_spin_require_particle(dom0);
+ eiotas_spin_send_particle(dom0,p0,EINA_FALSE);
+ eiotas_spin_send_particle(dom0,p1,EINA_TRUE);
+
+ /* add rooms */
+ Eiotas_Room *room = &dom0->room;
+ char name[8];
+ for(i=0; i<5; i++) {
+ sprintf(name,"room%d",i);
+ Eiotas_Room *tmp = eiotas_room_add(name,room);
+ if(tmp!=NULL) {
+ room = tmp;
+ eiotas_iota_show((Eiotas_Iota*)room); // MACROS
+ }
+ }
+ room = eiotas_room_add("room0",&dom0->room);
+ check_cond(room==NULL,"room0 should already exists");
+
+ eiotas_spin_free(dom0);
+}
+