summaryrefslogtreecommitdiff
path: root/cesar/bsu/aclf/test/utest/src/misc.c
blob: 4d184cc130009c378eeeaed8d9bdeba8ef7e4efd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
/* Cesar project {{{
 *
 * Copyright (C) 2010 Spidcom
 *
 * <<<Licence>>>
 *
 * }}} */
/**
 * \file    bsu/aclf/test/utest/src/misc.c
 * \brief   Miscellaneous tests.
 * \ingroup bsu_aclf
 *
 */
#include "common/std.h"
#include "lib/test.h"
#include "bsu/aclf/aclf.h"
#include "bsu/aclf/test/utest/common.h"

void
test_case_aclf__beacon_period (test_t test)
{
    test_case_begin (test, "ACLF beacon period");
    test_begin (test, "Get the beacon period")
    {
        u32 bpsd [4] = { 0, 30, 70, 150 };
        uint i;
        bsu_aclf_test_t t;
        bsu_aclf_test_init (&t);
        for (i = 0; i < COUNT(bpsd); i++)
            t.aclf->bpsd[i] = bpsd[i];
        for (i = 0; i < COUNT(bpsd) - 1; i++)
        {
            test_fail_unless (bpsd[i+1] - bpsd[i]
                              == bsu_aclf_beacon_period_tck (t.aclf));
            bsu_aclf_shift_beacon_period_start_date (t.aclf);
        }
        bsu_aclf_test_uninit (&t);
    }
    test_end;
}

void
test_suite_aclf__misc (test_t test)
{
    test_suite_begin (test, "Miscellaneous tests");
    test_case_aclf__beacon_period (test);
}