2016-02-09 06:43:19 +01:00
|
|
|
#include <platform.h>
|
|
|
|
#include "key.h"
|
|
|
|
|
|
|
|
#include <util/attrib.h>
|
|
|
|
#include <CuTest.h>
|
|
|
|
|
|
|
|
static void test_get_set_keys(CuTest *tc) {
|
|
|
|
attrib *a = 0;
|
|
|
|
key_set(&a, 42);
|
2016-02-09 06:45:28 +01:00
|
|
|
key_set(&a, 43);
|
|
|
|
key_set(&a, 44);
|
2016-02-09 06:43:19 +01:00
|
|
|
CuAssertTrue(tc, key_get(a, 42));
|
2016-02-09 06:45:28 +01:00
|
|
|
CuAssertTrue(tc, key_get(a, 43));
|
|
|
|
CuAssertTrue(tc, key_get(a, 44));
|
2016-02-09 06:43:19 +01:00
|
|
|
key_unset(&a, 42);
|
|
|
|
CuAssertTrue(tc, !key_get(a, 42));
|
2016-02-09 06:45:28 +01:00
|
|
|
CuAssertTrue(tc, key_get(a, 43));
|
|
|
|
CuAssertTrue(tc, key_get(a, 44));
|
|
|
|
a_removeall(&a, NULL);
|
2016-02-09 06:43:19 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
CuSuite *get_key_suite(void)
|
|
|
|
{
|
|
|
|
CuSuite *suite = CuSuiteNew();
|
|
|
|
SUITE_ADD_TEST(suite, test_get_set_keys);
|
|
|
|
return suite;
|
|
|
|
}
|