summaryrefslogtreecommitdiff
path: root/cesar/cp
diff options
context:
space:
mode:
authorNélio Laranjeiro2011-08-25 15:43:13 +0200
committerNélio Laranjeiro2011-08-30 10:28:54 +0200
commit99102ef0d1a4a5c0342db2989a7866f29756b37b (patch)
tree35b0b1b8c56085e4a482a05488496968cd5c8249 /cesar/cp
parent8337a24bc9357350dbdf8e6b590bf20eec0195dd (diff)
cesar/cp/{sta/mgr, cco/action}: fix unit test since librnd change
Diffstat (limited to 'cesar/cp')
-rw-r--r--cesar/cp/cco/action/test/src/action_gen_nek.c22
-rw-r--r--cesar/cp/sta/mgr/test/src/sta_mgr.c9
2 files changed, 15 insertions, 16 deletions
diff --git a/cesar/cp/cco/action/test/src/action_gen_nek.c b/cesar/cp/cco/action/test/src/action_gen_nek.c
index 513d4f50a6..ea2f334c10 100644
--- a/cesar/cp/cco/action/test/src/action_gen_nek.c
+++ b/cesar/cp/cco/action/test/src/action_gen_nek.c
@@ -48,23 +48,21 @@ test_case_gen_nek (test_t test)
/* Initialise the seed of the random generator. */
cp_cco_action_init (&cp);
- lib_rnd_init (&cp.rnd, 0x12345678);
test_begin (test, "Verify first shot")
{
uint i;
- uint computed_keys [4] = {0xf48aa84f, 0xb3b084cb, 0xdf36c134,
- 0xaa4010d2};
+ cp_key_t computed_keys;
+ lib_rnd_init (&cp.rnd, 0x12345678);
+ cp_secu_generate_key(&cp, lib_rnd32 (&cp.rnd),
+ 5, &computed_keys);
+ lib_rnd_init (&cp.rnd, 0x12345678);
cp_cco_action_cco__cco_nek_change (&cp);
-
- for (i = 0; i < 4; i++)
- printf ("Keys : %x, computed : %x\n", cp.cco_action.nek_new.key[i],
- computed_keys[i]);
-
- test_fail_unless (cp.cco_action.nek_new.key[0] == computed_keys[0]);
- test_fail_unless (cp.cco_action.nek_new.key[1] == computed_keys[1]);
- test_fail_unless (cp.cco_action.nek_new.key[2] == computed_keys[2]);
- test_fail_unless (cp.cco_action.nek_new.key[3] == computed_keys[3]);
+ for (i = 0; i < COUNT (cp.cco_action.nek_new.key); i++)
+ {
+ test_fail_unless (cp.cco_action.nek_new.key[i]
+ == computed_keys.key[i]);
+ }
}
test_end;
}
diff --git a/cesar/cp/sta/mgr/test/src/sta_mgr.c b/cesar/cp/sta/mgr/test/src/sta_mgr.c
index 2269be2a5d..3f49c6246c 100644
--- a/cesar/cp/sta/mgr/test/src/sta_mgr.c
+++ b/cesar/cp/sta/mgr/test/src/sta_mgr.c
@@ -1305,15 +1305,16 @@ test_case__cp_sta_mgr_partial_ack (test_t test)
test_begin (test, "Two STA")
{
uint i;
+ bool teis[3] = {false, false, false};
cp_sta_t *sta = cp_sta_mgr_sta_add (&cp, net, 2, 2);
- cp_tei_t tei_cmp[] = { 1, 1, 1, 2, 1, 2, 2, 1, 1, 2, 1, 1, 2, 1, 2, 1,
- 1, 1, 2, 2 };
for (i = 0; i < 20; i++)
{
cp_sta_mgr_elects_sta_partial_ack (&cp);
- test_fail_unless (cp.mac_config->partial_ack_tei_default ==
- tei_cmp[i]);
+ teis[cp.mac_config->partial_ack_tei_default] = true;
}
+ test_fail_unless (teis[0] == false);
+ for (i = 1; i < COUNT (teis); i++)
+ test_fail_unless (teis[i] == true);
slab_release (sta);
}
test_end;