aboutsummaryrefslogtreecommitdiffstats
path: root/src/libstrongswan/tests/test_utils.c
diff options
context:
space:
mode:
authorMartin Willi <martin@revosec.ch>2013-07-29 09:00:56 +0200
committerMartin Willi <martin@revosec.ch>2013-07-29 09:00:56 +0200
commit14dfdf7dacfff99aa4ba468e8618afaec1c0657b (patch)
tree17a1c5df0603cd8a093432e4003638e6a256a4b4 /src/libstrongswan/tests/test_utils.c
parent7612a6e42fa4779adbeab74ec044bd554d00c3b3 (diff)
parent9d75f04eee7fd4e0f9b14fac3f9a67993d8c2267 (diff)
downloadstrongswan-14dfdf7dacfff99aa4ba468e8618afaec1c0657b.tar.bz2
strongswan-14dfdf7dacfff99aa4ba468e8618afaec1c0657b.tar.xz
Merge branch 'xauth-radius'
Implements verification of XAuth credentials using simple RADIUS User-Name and (encrypted) User-Password attributes. The XAuth backend is implemented in the eap-radius plugin, reusing all existing infrastructure and features found in that plugin, including RADIUS accounting.
Diffstat (limited to 'src/libstrongswan/tests/test_utils.c')
-rw-r--r--src/libstrongswan/tests/test_utils.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/libstrongswan/tests/test_utils.c b/src/libstrongswan/tests/test_utils.c
index 811882e53..d9f1726ff 100644
--- a/src/libstrongswan/tests/test_utils.c
+++ b/src/libstrongswan/tests/test_utils.c
@@ -166,6 +166,28 @@ START_TEST(test_untoh)
END_TEST
/*******************************************************************************
+ * round_up/down
+ */
+
+START_TEST(test_round)
+{
+ ck_assert_int_eq(round_up(0, 4), 0);
+ ck_assert_int_eq(round_up(1, 4), 4);
+ ck_assert_int_eq(round_up(2, 4), 4);
+ ck_assert_int_eq(round_up(3, 4), 4);
+ ck_assert_int_eq(round_up(4, 4), 4);
+ ck_assert_int_eq(round_up(5, 4), 8);
+
+ ck_assert_int_eq(round_down(0, 4), 0);
+ ck_assert_int_eq(round_down(1, 4), 0);
+ ck_assert_int_eq(round_down(2, 4), 0);
+ ck_assert_int_eq(round_down(3, 4), 0);
+ ck_assert_int_eq(round_down(4, 4), 4);
+ ck_assert_int_eq(round_down(5, 4), 4);
+}
+END_TEST
+
+/*******************************************************************************
* memxor
*/
@@ -416,6 +438,10 @@ Suite *utils_suite_create()
tcase_add_test(tc, test_untoh);
suite_add_tcase(s, tc);
+ tc = tcase_create("round");
+ tcase_add_test(tc, test_round);
+ suite_add_tcase(s, tc);
+
tc = tcase_create("memxor");
tcase_add_test(tc, test_memxor);
tcase_add_test(tc, test_memxor_aligned);