diff options
author | Alexandra Ellwood <lxs@mit.edu> | 2008-10-24 19:40:35 +0000 |
---|---|---|
committer | Alexandra Ellwood <lxs@mit.edu> | 2008-10-24 19:40:35 +0000 |
commit | 9d3a0fa806297b18967f2108c637e65c6904987c (patch) | |
tree | e629db7a6ef036e72b6b438f216af71249437c58 /src/kim | |
parent | 246f30acb1f0e47216bcd89b2b8309845846adfb (diff) | |
download | krb5-9d3a0fa806297b18967f2108c637e65c6904987c.tar.gz krb5-9d3a0fa806297b18967f2108c637e65c6904987c.tar.xz krb5-9d3a0fa806297b18967f2108c637e65c6904987c.zip |
Add test for kim_identity_create_from_components
ticket: new
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@20917 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src/kim')
-rw-r--r-- | src/kim/test/main.c | 2 | ||||
-rw-r--r-- | src/kim/test/test_kim_identity.c | 50 | ||||
-rw-r--r-- | src/kim/test/test_kim_identity.h | 2 |
3 files changed, 54 insertions, 0 deletions
diff --git a/src/kim/test/main.c b/src/kim/test/main.c index 4ba1844dd7..e3efbd7f6a 100644 --- a/src/kim/test/main.c +++ b/src/kim/test/main.c @@ -40,6 +40,8 @@ int main (int argc, const char * argv[]) test_kim_identity_create_from_string (state); + test_kim_identity_create_from_components (state); + test_kim_identity_copy (state); test_kim_identity_compare (state); diff --git a/src/kim/test/test_kim_identity.c b/src/kim/test/test_kim_identity.c index e799aade24..2f1ac089f3 100644 --- a/src/kim/test/test_kim_identity.c +++ b/src/kim/test/test_kim_identity.c @@ -161,6 +161,56 @@ void test_kim_identity_create_from_string (kim_test_state_t state) /* ------------------------------------------------------------------------ */ +void test_kim_identity_create_from_components (kim_test_state_t state) +{ + kim_count i = 0; + + start_test (state, "kim_identity_create_from_components"); + + for (i = 0; test_identities[i].string; i++) { + kim_error err = KIM_NO_ERROR; + kim_identity identity = NULL; + kim_string string = NULL; + + printf ("."); + + if (!err) { + err = kim_identity_create_from_components (&identity, + test_identities[i].realm, + test_identities[i].components[0], + test_identities[i].components[1], + test_identities[i].components[2], + test_identities[i].components[3], + test_identities[i].components[4], + NULL); + fail_if_error (state, "kim_identity_create_from_components", err, + "while creating the identity for %s", + test_identities[i].string); + } + + if (!err) { + err = kim_identity_get_string (identity, &string); + fail_if_error (state, "kim_identity_get_string", err, + "while getting the string for %s", + test_identities[i].string); + } + + if (!err && strcmp (string, test_identities[i].string)) { + log_failure (state, "Unexpected string (got '%s', expected '%s')", + string, test_identities[i].string); + } + + kim_string_free (&string); + kim_identity_free (&identity); + } + + printf ("\n"); + + end_test (state); +} + +/* ------------------------------------------------------------------------ */ + void test_kim_identity_copy (kim_test_state_t state) { kim_count i = 0; diff --git a/src/kim/test/test_kim_identity.h b/src/kim/test/test_kim_identity.h index a294c2c3d6..cb7b29055f 100644 --- a/src/kim/test/test_kim_identity.h +++ b/src/kim/test/test_kim_identity.h @@ -33,6 +33,8 @@ void test_kim_identity_create_from_krb5_principal (kim_test_state_t state); void test_kim_identity_create_from_string (kim_test_state_t state); +void test_kim_identity_create_from_components (kim_test_state_t state); + void test_kim_identity_copy (kim_test_state_t state); void test_kim_identity_compare (kim_test_state_t state); |