X-Git-Url: http://www.project-moonshot.org/gitweb/?a=blobdiff_plain;f=json_gssapi%2Ftest%2FGSSCreateSecContextTest.cpp;h=cf3be568340178ef083b454827cde0cba4722e82;hb=ed6b9911b8d439a1587f2fe43c192c75614b471c;hp=dd006b418c7c161bd46b061c7f3e9345fbf34c28;hpb=c9a5ae83bf2a895d38f4ea43cdcf4a2ff5f97fd0;p=gssweb.git diff --git a/json_gssapi/test/GSSCreateSecContextTest.cpp b/json_gssapi/test/GSSCreateSecContextTest.cpp index dd006b4..cf3be56 100644 --- a/json_gssapi/test/GSSCreateSecContextTest.cpp +++ b/json_gssapi/test/GSSCreateSecContextTest.cpp @@ -12,11 +12,11 @@ #include #include #include -#include "util_json.h" +#include "utils/util_json.h" #include #include #include -#include +#include // Registers the fixture into the 'registry' CPPUNIT_TEST_SUITE_REGISTRATION( GSSCreateSecContextTest ); @@ -86,11 +86,11 @@ void GSSCreateSecContextTest::testConstructor() { GSSInitSecContext cmd = GSSInitSecContext(); - void *cmdFn; - void *GSSFn; + init_sec_context_type cmdFn; + init_sec_context_type GSSFn; cmdFn = cmd.getGSSFunction(); - GSSFn = (void *)&gss_init_sec_context; + GSSFn = &gss_init_sec_context; CPPUNIT_ASSERT_MESSAGE( "The default constructor for GSSCreateSecContextCommand should assign the function gss_init_sec_context", cmdFn == GSSFn); @@ -152,7 +152,7 @@ void GSSCreateSecContextTest::testConstructorWithJSONObject() GSSInitSecContext cmd = GSSInitSecContext( &json, - (void *)&mock_init_sec + &mock_init_sec ); const char *from_cmd = cmd.getTargetDisplayName(); @@ -193,7 +193,7 @@ GSSCreateSecContextTest::testEmptyCall() { gss_ctx_id_t expectedResult, expectedArgument; - GSSInitSecContext cmd ((void *)&mock_init_sec); + GSSInitSecContext cmd (&mock_init_sec); /* Set expectations on what the GSS function will be called with */ cmd.time_req = rand() % 1024; @@ -309,7 +309,7 @@ GSSCreateSecContextTest::testEmptyCall() void GSSCreateSecContextTest::testJSONMarshal() { /* Variables */ - GSSInitSecContext cmd ((void *)&mock_init_sec); + GSSInitSecContext cmd (&mock_init_sec); JSONObject *result; GSSContextCache *cache = GSSContextCache::instance(); GSSContext context; @@ -360,14 +360,19 @@ void GSSCreateSecContextTest::testJSONMarshal() - unsigned long len; std::string str = (*result)["output_token"].string(); - unsigned char *decoded = base64_decode(str, &len); + size_t len; + void *decoded = base64Decode(str.c_str(), &len); + CPPUNIT_ASSERT_MESSAGE( + "The decoded token size is incorrect", + ( len == InitSecContextMock::output_token.length ) + ); CPPUNIT_ASSERT_MESSAGE( "The output_token value was reported incorrectly", - ( strcmp((const char *)(InitSecContextMock::output_token.value), - (const char *)decoded ) == 0 ) + ( memcmp(InitSecContextMock::output_token.value, + decoded, len ) == 0 ) ); + base64Free(decoded); CPPUNIT_ASSERT_EQUAL_MESSAGE( "The minor_status value was reported incorrectly",