summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2012-06-01 16:46:06 +0200
committerJérémy Zurcher <jeremy@asynk.ch>2012-06-01 16:46:06 +0200
commit5286704c1363b4d291d5c649c4a12830069065e5 (patch)
tree3738733621266540818fc8321fd51f25889fed09
parent22353b2bbb1b1db6cbfb915183974c259d165a22 (diff)
downloadedoors-5286704c1363b4d291d5c649c4a12830069065e5.zip
edoors-5286704c1363b4d291d5c649c4a12830069065e5.tar.gz
test/particle: check eiotas_particle_split_dst
-rw-r--r--tests/particle.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/tests/particle.c b/tests/particle.c
index 402e0c5..272b5be 100644
--- a/tests/particle.c
+++ b/tests/particle.c
@@ -97,6 +97,39 @@ void test_particle()
if(eiotas_particle_data_get(p0,"key1")!=NULL) fprintf(stderr,"ERROR\n");
check_cond((p0->link_value==NULL),"link_value should be NULL");
+ eiotas_particle_destinations_add(p2,"door");
+ eiotas_particle_split_dst(p2);
+ check_cond((p2->cur_room==NULL),"room must be NULL");
+ check_str((char*)p2->cur_door,"door","door is wrong");
+ check_cond((p2->cur_action==NULL),"action must be NULL");
+
+ eiotas_particle_next_dst(p2);
+ eiotas_particle_destinations_add(p2,"door?get");
+ eiotas_particle_split_dst(p2);
+ check_str((char*)p2->cur_action,"get","action is wrong");
+ check_str((char*)p2->cur_door,"door","door is wrong");
+ check_cond((p2->cur_room==NULL),"room must be NULL");
+
+ eiotas_particle_next_dst(p2);
+ eiotas_particle_destinations_add(p2,"room/room/door");
+ eiotas_particle_split_dst(p2);
+ check_cond((p2->cur_action==NULL),"action must be NULL");
+ check_str((char*)p2->cur_door,"door","door is wrong");
+ check_str((char*)p2->cur_room,"room/room","room is wrong");
+
+ eiotas_particle_next_dst(p2);
+ eiotas_particle_destinations_add(p2,"room/room/door?get");
+ eiotas_particle_split_dst(p2);
+ check_str((char*)p2->cur_action,"get","action is wrong");
+ check_str((char*)p2->cur_door,"door","door is wrong");
+ check_str((char*)p2->cur_room,"room/room","room is wrong");
+
+ eiotas_particle_next_dst(p2);
+ eiotas_particle_destinations_add(p2,"room/room/door?get");
+ eiotas_particle_split_dst(p2);
+ check_str((char*)p2->cur_action,"get","action is wrong");
+ check_str((char*)p2->cur_door,"door","door is wrong");
+ check_str((char*)p2->cur_room,"room/room","room is wrong");
p2 = eiotas_require_particle(dom0);
p3 = eiotas_require_particle(dom0);