void test_case_sample(void) { CU_ASSERT(CU_TRUE); CU_ASSERT_NOT_EQUAL(2, -1); CU_ASSERT_STRING_EQUAL("string #1", "string #1"); CU_ASSERT_STRING_NOT_EQUAL("string #1", "string #2"); CU_ASSERT(CU_FALSE); CU_ASSERT_EQUAL(2, 3); CU_ASSERT_STRING_NOT_EQUAL("string #1", "string #1"); CU_ASSERT_STRING_EQUAL("string #1", "string #2"); }
void deleteindex(void) { char shindexstr[1024]; sprintf(shindexstr, "../src/mdb %s -k2 D", db); const char *indexrv = shrun(shindexstr); CU_ASSERT_STRING_NOT_EQUAL(indexrv, "Error 0\n"); char grepstr[1024]; sprintf(grepstr, "ls data/ | grep %s.idx2", db); const char *greprv = shrun(grepstr); char teststr[1024]; sprintf(teststr, "%s.idx2", db); CU_ASSERT_STRING_NOT_EQUAL(indexrv, teststr); }
static void testUriHeadersInInvite(void) { belle_sip_request_t* request; belle_sip_stack_t *stack=belle_sip_stack_new(NULL); belle_sip_provider_t *prov=belle_sip_provider_new(stack,NULL); const char* raw_uri="sip:[email protected]" "?header1=blabla" "&header2=blue%3Bweftutu%3Dbla" "&From=toto" "&To=sip%3Atoto%40titi.com" "&Call-ID=asdads" "&CSeq=asdasd" "&Via=asdasd" "&Accept=adsad" "&Accept-Encoding=adsad" "&Accept-Language=adsad" "&Allow=adsad" "&Record-Route=adsad" "&Contact=adsad" "&Organization=adsad" "&Supported=adsad" "&User-Agent=adsad"; belle_sip_header_t* raw_header; request=belle_sip_request_create( belle_sip_uri_parse(raw_uri) ,"INVITE" ,belle_sip_provider_create_call_id(prov) ,belle_sip_header_cseq_create(20,"INVITE") ,belle_sip_header_from_create2("sip:[email protected]","4654") ,NULL ,belle_sip_header_via_new() ,70); CU_ASSERT_PTR_NOT_NULL(request); CU_ASSERT_PTR_NOT_NULL(raw_header=belle_sip_message_get_header(BELLE_SIP_MESSAGE(request),"header1")); if (raw_header) { CU_ASSERT_STRING_EQUAL(belle_sip_header_extension_get_value(BELLE_SIP_HEADER_EXTENSION(raw_header)),"blabla"); } CU_ASSERT_PTR_NOT_NULL(raw_header=belle_sip_message_get_header(BELLE_SIP_MESSAGE(request),"header2")); if (raw_header) { CU_ASSERT_STRING_EQUAL(belle_sip_header_extension_get_value(BELLE_SIP_HEADER_EXTENSION(raw_header)),"blue;weftutu=bla"); } CU_ASSERT_PTR_NOT_NULL(raw_header=belle_sip_message_get_header(BELLE_SIP_MESSAGE(request),"To")); if (raw_header) { CU_ASSERT_STRING_EQUAL(belle_sip_header_extension_get_value(BELLE_SIP_HEADER_EXTENSION(raw_header)),"sip:[email protected]"); } CU_ASSERT_STRING_NOT_EQUAL(belle_sip_header_get_unparsed_value(belle_sip_message_get_header(BELLE_SIP_MESSAGE(request),"From")),"toto"); CU_ASSERT_PTR_NULL(belle_sip_message_get_header(BELLE_SIP_MESSAGE(request),"Record-Route")); CU_ASSERT_PTR_NULL(belle_sip_message_get_header(BELLE_SIP_MESSAGE(request),"Accept")); CU_ASSERT_PTR_NULL(belle_sip_message_get_header(BELLE_SIP_MESSAGE(request),"Accept-Encoding")); CU_ASSERT_PTR_NULL(belle_sip_message_get_header(BELLE_SIP_MESSAGE(request),"Accept-Language")); CU_ASSERT_PTR_NULL(belle_sip_message_get_header(BELLE_SIP_MESSAGE(request),"Allow")); CU_ASSERT_PTR_NULL(belle_sip_message_get_header(BELLE_SIP_MESSAGE(request),"Contact")); CU_ASSERT_PTR_NULL(belle_sip_message_get_header(BELLE_SIP_MESSAGE(request),"Organization")); CU_ASSERT_PTR_NULL(belle_sip_message_get_header(BELLE_SIP_MESSAGE(request),"Supported")); CU_ASSERT_PTR_NULL(belle_sip_message_get_header(BELLE_SIP_MESSAGE(request),"User-Agent")); belle_sip_object_unref(request); }
void test_sha512_normal() { char *text = "ldlelslelslelslslflelslalelslsslldlelslelslelslslflelslalelslssl"; enum HashAlgorithm algorithm = SHA512; initCryptographyModule(); char *hash = hashString(text, algorithm); CU_ASSERT_STRING_NOT_EQUAL(text, hash); freeCryptographyModuleMemory(); free(hash); }
static void nvmf_test_create_subsystem(void) { char correct_name[] = "subsystem1"; char wrong_name[512]; struct spdk_nvmf_subsystem *subsystem; struct spdk_nvmf_ctrlr *nvmf_ctrlr; subsystem = nvmf_create_subsystem(1, correct_name); SPDK_CU_ASSERT_FATAL(subsystem != NULL); CU_ASSERT_EQUAL(subsystem->num, 1); CU_ASSERT_STRING_EQUAL(subsystem->subnqn, correct_name); nvmf_ctrlr = spdk_nvmf_ctrlr_claim("Nvme0"); SPDK_CU_ASSERT_FATAL(nvmf_ctrlr != NULL); nvmf_subsystem_add_ns(subsystem, nvmf_ctrlr->ctrlr); /* test long name */ memset(wrong_name, 'a', 512); subsystem = nvmf_create_subsystem(2, wrong_name); SPDK_CU_ASSERT_FATAL(subsystem != NULL); CU_ASSERT_EQUAL(subsystem->num, 2); CU_ASSERT_STRING_NOT_EQUAL(subsystem->subnqn, wrong_name); CU_ASSERT_EQUAL(strlen(subsystem->subnqn) + 1, MAX_NQN_SIZE); }
void test_failure3(void) { CU_ASSERT_STRING_NOT_EQUAL("string #1", "string #1"); }
void test_success4(void) { CU_ASSERT_STRING_NOT_EQUAL("string #1", "string #2"); }
static void call_with_transport_base(LinphoneTunnelMode tunnel_mode, bool_t with_sip, LinphoneMediaEncryption encryption) { if (linphone_core_tunnel_available()){ LinphoneCoreManager *pauline = linphone_core_manager_new( "pauline_rc"); LinphoneCoreManager *marie = linphone_core_manager_new( "marie_rc"); LinphoneCall *pauline_call; LinphoneProxyConfig *proxy = linphone_core_get_default_proxy_config(pauline->lc); LinphoneAddress *server_addr = linphone_address_new(linphone_proxy_config_get_server_addr(proxy)); LinphoneAddress *route = linphone_address_new(linphone_proxy_config_get_route(proxy)); const char * tunnel_ip = get_ip_from_hostname("tunnel.linphone.org"); char *public_ip, *public_ip2=NULL; CU_ASSERT_TRUE(wait_for(pauline->lc,NULL,&pauline->stat.number_of_LinphoneRegistrationOk,1)); public_ip = get_public_contact_ip(pauline->lc); CU_ASSERT_STRING_NOT_EQUAL(public_ip, tunnel_ip); linphone_core_set_media_encryption(pauline->lc, encryption); if (tunnel_mode != LinphoneTunnelModeDisable){ LinphoneTunnel *tunnel = linphone_core_get_tunnel(pauline->lc); LinphoneTunnelConfig *config = linphone_tunnel_config_new(); linphone_tunnel_config_set_host(config, "tunnel.linphone.org"); linphone_tunnel_config_set_port(config, 443); linphone_tunnel_config_set_remote_udp_mirror_port(config, 12345); linphone_tunnel_add_server(tunnel, config); linphone_tunnel_set_mode(tunnel, tunnel_mode); linphone_tunnel_enable_sip(tunnel, with_sip); /* * Enabling the tunnel with sip cause another REGISTER to be made. * In automatic mode, the udp test should conclude (assuming we have a normal network), that no * tunnel is needed. Thus the number of registrations should stay to 1. * The library is missing a notification of "tunnel connectivity test finished" to enable the * full testing of the automatic mode. */ if(tunnel_mode == LinphoneTunnelModeEnable && with_sip) { CU_ASSERT_TRUE(wait_for(pauline->lc,NULL,&pauline->stat.number_of_LinphoneRegistrationOk,2)); /* Ensure that we did use the tunnel. If so, we should see contact changed from: Contact: <sip:[email protected]>;.[...] To: Contact: <sip:[email protected]:43867>;[....] (91.121.209.194 must be tunnel.liphone.org) */ ms_free(public_ip); public_ip = get_public_contact_ip(pauline->lc); CU_ASSERT_STRING_EQUAL(public_ip, tunnel_ip); } else { public_ip2 = get_public_contact_ip(pauline->lc); CU_ASSERT_STRING_EQUAL(public_ip, public_ip2); } } CU_ASSERT_TRUE(call(pauline,marie)); pauline_call=linphone_core_get_current_call(pauline->lc); CU_ASSERT_PTR_NOT_NULL(pauline_call); if (pauline_call!=NULL){ CU_ASSERT_EQUAL(linphone_call_params_get_media_encryption(linphone_call_get_current_params(pauline_call)), encryption); } end_call(pauline,marie); ms_free(public_ip); if(public_ip2 != NULL) ms_free(public_ip2); linphone_address_destroy(server_addr); linphone_address_destroy(route); linphone_core_manager_destroy(pauline); linphone_core_manager_destroy(marie); }else{ ms_warning("Could not test %s because tunnel functionality is not available",__FUNCTION__); } }