Commit cc224b7f authored by Simon Morlat's avatar Simon Morlat

fix failed test, build improved for linux

parent bbb58199
......@@ -93,13 +93,20 @@ fi
AC_SUBST(ANTLR_CFLAGS)
AC_SUBST(ANTLR_LIBS)
dnl CUNIT_LIBS+=" -lncurses"
PKG_CHECK_MODULES(CUNIT, cunit, [found_cunit=yes],[found_cunit=no])
if test "$found_cunit" = "no" ; then
AC_CHECK_HEADERS(CUnit/CUnit.h,
[
found_cunit=yes
CUNIT_LIBS="-lcunit"
])
fi
AC_SUBST(CUNIT_CFLAGS)
CUNIT_LIBS+=-lncurses
AC_SUBST(CUNIT_LIBS)
if test x$found_cunit = xno ; then
if test "$found_cunit" = "no" ; then
AC_MSG_WARN([Could not find cunit framework, tests are not compiled.])
fi
......
......@@ -159,4 +159,14 @@ void belle_sip_client_transaction_init(belle_sip_client_transaction_t *obj, bell
belle_sip_transaction_init((belle_sip_transaction_t*)obj, prov,req);
}
belle_sip_ist_t *belle_sip_ist_new(belle_sip_provider_t *prov, belle_sip_request_t *req){
return NULL;
}
belle_sip_nist_t *belle_sip_nist_new(belle_sip_provider_t *prov, belle_sip_request_t *req){
return NULL;
}
belle_sip_nict_t *belle_sip_nict_new(belle_sip_provider_t *prov, belle_sip_request_t *req){
return NULL;
}
......@@ -10,7 +10,7 @@ belle_sip_tester_SOURCES= belle_sip_tester.c \
auth_helper_tester.c \
cast_test.c
belle_sip_tester_CFLAGS=$(CUNIT_CFLAGS)
belle_sip_tester_CFLAGS=$(CUNIT_CFLAGS) $(STRICT_OPTIONS)
belle_sip_tester_LDFLAGS=$(CUNIT_LIBS)
......
......@@ -360,7 +360,7 @@ void test_header_proxy_authenticate(void) {
" qop=\"auth,auth-int\", nonce=\"c60f3082ee1212b402a21831ae\", stale=true, domain=\"sip:boxesbybob.com\"";
belle_sip_header_proxy_authenticate_t* L_tmp;
belle_sip_header_proxy_authenticate_t* L_proxy_authorization = belle_sip_header_proxy_authenticate_parse(l_header);
belle_sip_list_t* qop;
//belle_sip_list_t* qop;
char* l_raw_header = belle_sip_object_to_string(BELLE_SIP_OBJECT(L_proxy_authorization));
belle_sip_object_unref(BELLE_SIP_OBJECT(L_proxy_authorization));
......
......@@ -32,37 +32,37 @@ static void cast_test(){
belle_sip_stack_t *stack=belle_sip_stack_new(NULL);
belle_sip_listening_point_t *lp=belle_sip_stack_create_listening_point(stack,"0.0.0.0",5060,"UDP");
belle_sip_provider_t *provider=belle_sip_stack_create_provider(stack,lp);
belle_sip_server_transaction_t *st=belle_sip_provider_create_server_transaction(provider,NULL);
belle_sip_client_transaction_t *ct=belle_sip_provider_create_client_transaction(provider,NULL);
belle_sip_transaction_t *t;
belle_sip_request_t *req=belle_sip_request_new();
belle_sip_response_t *resp=belle_sip_response_new();
belle_sip_message_t *msg;
int tmp;
CU_ASSERT_PTR_NOT_NULL(stack);
CU_ASSERT_PTR_NOT_NULL(lp);
CU_ASSERT_PTR_NOT_NULL(provider);
CU_ASSERT_PTR_NOT_NULL(st);
CU_ASSERT_PTR_NOT_NULL(ct);
CU_ASSERT_PTR_NOT_NULL(req);
CU_ASSERT_PTR_NOT_NULL(resp);
belle_sip_message("Casting belle_sip_server_transaction_t to belle_sip_transaction_t");
t=BELLE_SIP_TRANSACTION(st);
CU_ASSERT_PTR_NOT_NULL(t);
belle_sip_message("Casting belle_sip_request_t to belle_sip_message_t");
msg=BELLE_SIP_MESSAGE(req);
CU_ASSERT_PTR_NOT_NULL(msg);
belle_sip_message("Ok.");
belle_sip_message("Casting belle_sip_client_transaction_t to belle_sip_transaction_t");
t=BELLE_SIP_TRANSACTION(ct);
CU_ASSERT_PTR_NOT_NULL(t);
belle_sip_message("Casting belle_sip_response_t to belle_sip_message_t");
msg=BELLE_SIP_MESSAGE(resp);
CU_ASSERT_PTR_NOT_NULL(msg);
belle_sip_message("Ok.");
tmp=BELLE_SIP_IS_INSTANCE_OF(st,belle_sip_client_transaction_t);
belle_sip_message("Casting belle_sip_server_transaction_t to belle_sip_client_transaction_t: %s",tmp ? "yes" : "no");
tmp=BELLE_SIP_IS_INSTANCE_OF(req,belle_sip_response_t);
belle_sip_message("Casting belle_sip_request_t to belle_sip_response_t: %s",tmp ? "yes" : "no");
CU_ASSERT_EQUAL(tmp,0);
//ct=BELLE_SIP_CLIENT_TRANSACTION(st);
}
int belle_sip_cast_test_suite(){
CU_pSuite pSuite = CU_add_suite("Object inheritence", init_cast_suite, cleanup_cast_suite);
if (NULL == CU_add_test(pSuite, "casting transactions", cast_test)) {
if (NULL == CU_add_test(pSuite, "casting requests and responses", cast_test)) {
return CU_get_error();
}
return 0;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment