Skip to content
Snippets Groups Projects
test_format_cap.c 51.8 KiB
Newer Older
  • Learn to ignore specific revisions
  • 	RAII_VAR(struct ast_format *, ulaw_format, NULL, ao2_cleanup);
    	RAII_VAR(struct ast_codec *, alaw, NULL, ao2_cleanup);
    	RAII_VAR(struct ast_format *, alaw_format, NULL, ao2_cleanup);
    
    	switch (cmd) {
    	case TEST_INIT:
    		info->name = "format_cap_iscompatible";
    		info->category = "/main/format_cap/";
    		info->summary = "format capabilities negotiation unit test";
    		info->description =
    			"Test that checking if there are compatible formats between two capabilities structures succeeds";
    		return AST_TEST_NOT_RUN;
    	case TEST_EXECUTE:
    		break;
    	}
    
    	alaw_caps = ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_DEFAULT);
    	if (!alaw_caps) {
    		ast_test_status_update(test, "Could not allocate an empty format capabilities structure\n");
    		return AST_TEST_FAIL;
    	}
    
    	ulaw_caps = ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_DEFAULT);
    	if (!ulaw_caps) {
    		ast_test_status_update(test, "Could not allocate an empty format capabilities structure\n");
    		return AST_TEST_FAIL;
    	}
    
    	ulaw = ast_codec_get("ulaw", AST_MEDIA_TYPE_AUDIO, 8000);
    	if (!ulaw) {
    		ast_test_status_update(test, "Could not retrieve built-in ulaw codec\n");
    		return AST_TEST_FAIL;
    	}
    
    	ulaw_format = ast_format_create(ulaw);
    	if (!ulaw_format) {
    		ast_test_status_update(test, "Could not create ulaw format using built-in codec\n");
    		return AST_TEST_FAIL;
    	}
    
    	alaw = ast_codec_get("alaw", AST_MEDIA_TYPE_AUDIO, 8000);
    	if (!alaw) {
    		ast_test_status_update(test, "Could not retrieve built-in alaw codec\n");
    		return AST_TEST_FAIL;
    	}
    
    	alaw_format = ast_format_create(alaw);
    	if (!alaw_format) {
    		ast_test_status_update(test, "Could not create alaw format using built-in codec\n");
    		return AST_TEST_FAIL;
    	}
    
    	if (ast_format_cap_append(ulaw_caps, ulaw_format, 0)) {
    		ast_test_status_update(test, "Could not add ulaw format to ulaw capabilities\n");
    		return AST_TEST_FAIL;
    	} else if (ast_format_cap_append(alaw_caps, alaw_format, 0)) {
    		ast_test_status_update(test, "Could not add alaw format to alaw capabilities\n");
    		return AST_TEST_FAIL;
    	} else if (ast_format_cap_iscompatible(ulaw_caps, alaw_caps)) {
    		ast_test_status_update(test, "Two capability structures that should not be compatible are\n");
    		return AST_TEST_FAIL;
    	} else if (!ast_format_cap_iscompatible(ulaw_caps, ulaw_caps)) {
    		ast_test_status_update(test, "Capability structure is not compatible with itself\n");
    		return AST_TEST_FAIL;
    	}
    
    	return AST_TEST_PASS;
    }
    
    AST_TEST_DEFINE(format_cap_get_names)
    {
    	RAII_VAR(struct ast_format_cap *, empty_caps, NULL, ao2_cleanup);
    	RAII_VAR(struct ast_format_cap *, multi_caps, NULL, ao2_cleanup);
    	RAII_VAR(struct ast_format_cap *, alaw_caps, NULL, ao2_cleanup);
    	RAII_VAR(struct ast_format_cap *, ulaw_caps, NULL, ao2_cleanup);
    	RAII_VAR(struct ast_codec *, ulaw, NULL, ao2_cleanup);
    	RAII_VAR(struct ast_format *, ulaw_format, NULL, ao2_cleanup);
    	RAII_VAR(struct ast_codec *, alaw, NULL, ao2_cleanup);
    	RAII_VAR(struct ast_format *, alaw_format, NULL, ao2_cleanup);
    
    	struct ast_str *buffer = ast_str_alloca(AST_FORMAT_CAP_NAMES_LEN);
    
    
    	switch (cmd) {
    	case TEST_INIT:
    		info->name = "format_cap_get_names";
    		info->category = "/main/format_cap/";
    		info->summary = "Test getting the names of formats";
    		info->description =
    			"Test that obtaining the names from a format capabilities structure\n"
    
    			"produces the expected output.";
    
    1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477
    		return AST_TEST_NOT_RUN;
    	case TEST_EXECUTE:
    		break;
    	}
    
    	empty_caps = ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_DEFAULT);
    	if (!empty_caps) {
    		ast_test_status_update(test, "Could not allocate an empty format capabilities structure\n");
    		return AST_TEST_FAIL;
    	}
    
    	multi_caps = ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_DEFAULT);
    	if (!multi_caps) {
    		ast_test_status_update(test, "Could not allocate an empty format capabilities structure\n");
    		return AST_TEST_FAIL;
    	}
    
    	alaw_caps = ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_DEFAULT);
    	if (!alaw_caps) {
    		ast_test_status_update(test, "Could not allocate an empty format capabilities structure\n");
    		return AST_TEST_FAIL;
    	}
    
    	ulaw_caps = ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_DEFAULT);
    	if (!ulaw_caps) {
    		ast_test_status_update(test, "Could not allocate an empty format capabilities structure\n");
    		return AST_TEST_FAIL;
    	}
    
    	ulaw = ast_codec_get("ulaw", AST_MEDIA_TYPE_AUDIO, 8000);
    	if (!ulaw) {
    		ast_test_status_update(test, "Could not retrieve built-in ulaw codec\n");
    		return AST_TEST_FAIL;
    	}
    
    	ulaw_format = ast_format_create(ulaw);
    	if (!ulaw_format) {
    		ast_test_status_update(test, "Could not create ulaw format using built-in codec\n");
    		return AST_TEST_FAIL;
    	}
    
    	alaw = ast_codec_get("alaw", AST_MEDIA_TYPE_AUDIO, 8000);
    	if (!alaw) {
    		ast_test_status_update(test, "Could not retrieve built-in alaw codec\n");
    		return AST_TEST_FAIL;
    	}
    
    	alaw_format = ast_format_create(alaw);
    	if (!alaw_format) {
    		ast_test_status_update(test, "Could not create alaw format using built-in codec\n");
    		return AST_TEST_FAIL;
    	}
    
    	if (ast_format_cap_append(ulaw_caps, ulaw_format, 0)) {
    		ast_test_status_update(test, "Could not add ulaw format to ulaw capabilities\n");
    		return AST_TEST_FAIL;
    	} else if (ast_format_cap_append(alaw_caps, alaw_format, 0)) {
    		ast_test_status_update(test, "Could not add alaw format to alaw capabilities\n");
    		return AST_TEST_FAIL;
    	} else if (ast_format_cap_append(multi_caps, ulaw_format, 0)) {
    		ast_test_status_update(test, "Could not add ulaw format to multi capabilities\n");
    		return AST_TEST_FAIL;
    	} else if (ast_format_cap_append(multi_caps, alaw_format, 0)) {
    		ast_test_status_update(test, "Could not add alaw format to multi capabilities\n");
    		return AST_TEST_FAIL;
    	}
    
    	ast_format_cap_get_names(empty_caps, &buffer);
    	ast_test_validate(test, !strcmp(ast_str_buffer(buffer), "(nothing)"));
    	ast_format_cap_get_names(ulaw_caps, &buffer);
    	ast_test_validate(test, !strcmp(ast_str_buffer(buffer), "(ulaw)"));
    	ast_format_cap_get_names(alaw_caps, &buffer);
    	ast_test_validate(test, !strcmp(ast_str_buffer(buffer), "(alaw)"));
    	ast_format_cap_get_names(multi_caps, &buffer);
    	ast_test_validate(test, !strcmp(ast_str_buffer(buffer), "(ulaw|alaw)"));
    
    
    	return AST_TEST_PASS;
    }
    
    AST_TEST_DEFINE(format_cap_best_by_type)
    {
    	RAII_VAR(struct ast_format_cap *, caps, NULL, ao2_cleanup);
    	RAII_VAR(struct ast_codec *, ulaw, NULL, ao2_cleanup);
    	RAII_VAR(struct ast_format *, ulaw_format, NULL, ao2_cleanup);
    	RAII_VAR(struct ast_codec *, alaw, NULL, ao2_cleanup);
    	RAII_VAR(struct ast_format *, alaw_format, NULL, ao2_cleanup);
    	RAII_VAR(struct ast_codec *, h263, NULL, ao2_cleanup);
    	RAII_VAR(struct ast_format *, h263_format, NULL, ao2_cleanup);
    	RAII_VAR(struct ast_format *, best_format, NULL, ao2_cleanup);
    
    	switch (cmd) {
    	case TEST_INIT:
    		info->name = __PRETTY_FUNCTION__;
    		info->category = "/main/format_cap/";
    		info->summary = "format capabilities best by type unit test";
    		info->description =
    			"Test that we can get the best format type out of a capabilities structure";
    		return AST_TEST_NOT_RUN;
    	case TEST_EXECUTE:
    		break;
    	}
    
    	caps = ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_DEFAULT);
    	if (!caps) {
    		ast_test_status_update(test, "Could not allocate an empty format capabilities structure\n");
    		return AST_TEST_FAIL;
    	}
    
    	ulaw = ast_codec_get("ulaw", AST_MEDIA_TYPE_AUDIO, 8000);
    	if (!ulaw) {
    		ast_test_status_update(test, "Could not retrieve built-in ulaw codec\n");
    		return AST_TEST_FAIL;
    	}
    
    	ulaw_format = ast_format_create(ulaw);
    	if (!ulaw_format) {
    		ast_test_status_update(test, "Could not create ulaw format using built-in codec\n");
    		return AST_TEST_FAIL;
    	}
    
    	alaw = ast_codec_get("alaw", AST_MEDIA_TYPE_AUDIO, 8000);
    	if (!alaw) {
    		ast_test_status_update(test, "Could not retrieve built-in alaw codec\n");
    		return AST_TEST_FAIL;
    	}
    
    	alaw_format = ast_format_create(alaw);
    	if (!alaw_format) {
    		ast_test_status_update(test, "Could not create alaw format using built-in codec\n");
    		return AST_TEST_FAIL;
    	}
    
    	h263 = ast_codec_get("h263", AST_MEDIA_TYPE_VIDEO, 0);
    	if (!h263) {
    		ast_test_status_update(test, "Could not retrieve built-in h263 codec\n");
    		return AST_TEST_FAIL;
    	}
    
    	h263_format = ast_format_create(h263);
    	if (!alaw_format) {
    		ast_test_status_update(test, "Could not create h263 format using built-in codec\n");
    		return AST_TEST_FAIL;
    	}
    
    	if (ast_format_cap_append(caps, ulaw_format, 0)) {
    		ast_test_status_update(test, "Could not add ulaw format to capabilities\n");
    		return AST_TEST_FAIL;
    	} else if (ast_format_cap_append(caps, alaw_format, 0)) {
    		ast_test_status_update(test, "Could not add alaw format to capabilities\n");
    		return AST_TEST_FAIL;
    	} else if (ast_format_cap_append(caps, h263_format, 0)) {
    		ast_test_status_update(test, "Could not add h263 format to capabilities\n");
    		return AST_TEST_FAIL;
    	}
    
    	best_format = ast_format_cap_get_best_by_type(caps, AST_MEDIA_TYPE_UNKNOWN);
    	ast_test_validate(test, ast_format_cmp(best_format, ulaw_format) == AST_FORMAT_CMP_EQUAL);
    	ao2_ref(best_format, -1);
    
    	best_format = ast_format_cap_get_best_by_type(caps, AST_MEDIA_TYPE_AUDIO);
    	ast_test_validate(test, ast_format_cmp(best_format, ulaw_format) == AST_FORMAT_CMP_EQUAL);
    	ao2_ref(best_format, -1);
    
    	best_format = ast_format_cap_get_best_by_type(caps, AST_MEDIA_TYPE_VIDEO);
    	ast_test_validate(test, ast_format_cmp(best_format, h263_format) == AST_FORMAT_CMP_EQUAL);
    	ao2_ref(best_format, -1);
    
    	best_format = ast_format_cap_get_best_by_type(caps, AST_MEDIA_TYPE_IMAGE);
    	ast_test_validate(test, best_format == NULL);
    
    	best_format = ast_format_cap_get_best_by_type(caps, AST_MEDIA_TYPE_TEXT);
    	ast_test_validate(test, best_format == NULL);
    
    	return AST_TEST_PASS;
    }
    
    static int test_law_samples(struct ast_frame *frame)
    {
    	return frame->datalen;
    }
    
    static int test_law_length(unsigned int samples)
    {
    	return samples;
    }
    
    static struct ast_codec test_law = {
    	.name = "test_law",
    	.description = "format cap unit test codec",
    	.type = AST_MEDIA_TYPE_AUDIO,
    	.sample_rate = 8000,
    	.minimum_ms = 10,
    	.maximum_ms = 150,
    	.default_ms = 20,
    	.samples_count = test_law_samples,
    	.get_length = test_law_length,
    	.smooth = 1,
    };
    
    static enum ast_format_cmp_res test_law_cmp(const struct ast_format *format1, const struct ast_format *format2)
    {
    	ast_log(LOG_ERROR, "Comparing format1 %p and format2 %p\n", format1, format2);
    	return format1 == format2 ? AST_FORMAT_CMP_EQUAL : AST_FORMAT_CMP_NOT_EQUAL;
    }
    
    static void test_law_destroy(struct ast_format *format)
    {
    }
    
    static int test_law_clone(const struct ast_format *src, struct ast_format *dst)
    {
    	return 0;
    }
    
    static struct ast_format_interface test_law_interface = {
    	.format_cmp = test_law_cmp,
    	.format_clone = test_law_clone,
    	.format_destroy = test_law_destroy,
    };
    
    AST_TEST_DEFINE(format_cap_replace_from_cap)
    {
    	RAII_VAR(struct ast_format_cap *, caps, NULL, ao2_cleanup);
    	RAII_VAR(struct ast_format_cap *, replace_caps, NULL, ao2_cleanup);
    	RAII_VAR(struct ast_format_cap *, result_caps, NULL, ao2_cleanup);
    	RAII_VAR(struct ast_codec *, ulaw, NULL, ao2_cleanup);
    	RAII_VAR(struct ast_format *, ulaw_format, NULL, ao2_cleanup);
    	RAII_VAR(struct ast_format *, ulaw_format_variant, NULL, ao2_cleanup);
    	RAII_VAR(struct ast_codec *, alaw, NULL, ao2_cleanup);
    	RAII_VAR(struct ast_format *, alaw_format, NULL, ao2_cleanup);
    
    	switch (cmd) {
    	case TEST_INIT:
    		info->name = __PRETTY_FUNCTION__;
    		info->category = "/main/format_cap/";
    		info->summary = "format capabilities adding unit test";
    		info->description =
    			"Test that adding multiple formats to a format capabilities structure succeeds";
    		return AST_TEST_NOT_RUN;
    	case TEST_EXECUTE:
    		break;
    	}
    
    	caps = ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_DEFAULT);
    	replace_caps = ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_DEFAULT);
    	result_caps = ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_DEFAULT);
    	if (!caps || !replace_caps || !result_caps) {
    		ast_test_status_update(test, "Could not allocate an empty format capabilities structure\n");
    		return AST_TEST_FAIL;
    	}
    
    	ulaw = ast_codec_get("test_law", AST_MEDIA_TYPE_AUDIO, 8000);
    	if (!ulaw) {
    		ast_test_status_update(test, "Could not retrieve test_law codec\n");
    		return AST_TEST_FAIL;
    	}
    
    	ulaw_format = ast_format_create(ulaw);
    	if (!ulaw_format) {
    		ast_test_status_update(test, "Could not create ulaw format using built-in codec\n");
    		return AST_TEST_FAIL;
    	}
    
    	ulaw_format_variant = ast_format_create(ulaw);
    	if (!ulaw_format_variant) {
    		ast_test_status_update(test, "Could not create ulaw format variant using built-in codec\n");
    		return AST_TEST_FAIL;
    	}
    
    	alaw = ast_codec_get("alaw", AST_MEDIA_TYPE_AUDIO, 8000);
    	if (!alaw) {
    		ast_test_status_update(test, "Could not retrieve built-in alaw codec\n");
    		return AST_TEST_FAIL;
    	}
    
    	alaw_format = ast_format_create(alaw);
    	if (!alaw_format) {
    		ast_test_status_update(test, "Could not create alaw format using built-in codec\n");
    		return AST_TEST_FAIL;
    	}
    
    	/* fill caps with ulaw and alaw */
    	if (ast_format_cap_append(caps, ulaw_format, 42)) {
    		ast_test_status_update(test, "Could not add ulaw format to capabilities structure\n");
    		return AST_TEST_FAIL;
    	}
    	if (ast_format_cap_append(caps, alaw_format, 84)) {
    		ast_test_status_update(test, "Could not add alaw format to capabilities structure\n");
    		return AST_TEST_FAIL;
    	}
    	if (ast_format_cap_count(caps) != 2) {
    		ast_test_status_update(test, "Number of formats in capabilities structure should be 2 but is %zu\n",
    			ast_format_cap_count(caps));
    		return AST_TEST_FAIL;
    	}
    
    	/* fill replace_caps with the ulaw variant */
    	if (ast_format_cap_append(replace_caps, ulaw_format_variant, 42)) {
    		ast_test_status_update(test, "Could not add ulaw format to capabilities structure\n");
    		return AST_TEST_FAIL;
    	}
    	if (ast_format_cap_count(replace_caps) != 1) {
    		ast_test_status_update(test, "Number of formats in capabilities structure should be 1 but is %zu\n",
    			ast_format_cap_count(replace_caps));
    		return AST_TEST_FAIL;
    	}
    
    	/* fill result_caps with ulaw_variant and alaw */
    	if (ast_format_cap_append(result_caps, ulaw_format_variant, 42)) {
    		ast_test_status_update(test, "Could not add ulaw variant to capabilities structure\n");
    		return AST_TEST_FAIL;
    	}
    	if (ast_format_cap_append(result_caps, alaw_format, 84)) {
    		ast_test_status_update(test, "Could not add alaw format to capabilities structure\n");
    		return AST_TEST_FAIL;
    	}
    	if (ast_format_cap_count(result_caps) != 2) {
    		ast_test_status_update(test, "Number of formats in capabilities structure should be 2 but is %zu\n",
    			ast_format_cap_count(result_caps));
    		return AST_TEST_FAIL;
    	}
    
    	/* replace caps formats from replace_caps */
    	ast_format_cap_replace_from_cap(caps, replace_caps, AST_MEDIA_TYPE_UNKNOWN);
    
    	/* compare result_caps with caps */
    	if (!ast_format_cap_identical(caps, result_caps)) {
    		ast_test_status_update(test, "Actual and expected result caps differ\n");
    		return AST_TEST_FAIL;
    	}
    
    	return AST_TEST_PASS;
    }
    
    static int unload_module(void)
    {
    	AST_TEST_UNREGISTER(format_cap_alloc);
    	AST_TEST_UNREGISTER(format_cap_append_single);
    	AST_TEST_UNREGISTER(format_cap_append_multiple);
    	AST_TEST_UNREGISTER(format_cap_append_all_unknown);
    	AST_TEST_UNREGISTER(format_cap_append_all_audio);
    	AST_TEST_UNREGISTER(format_cap_append_duplicate);
    	AST_TEST_UNREGISTER(format_cap_append_from_cap);
    	AST_TEST_UNREGISTER(format_cap_append_from_cap_duplicate);
    	AST_TEST_UNREGISTER(format_cap_set_framing);
    	AST_TEST_UNREGISTER(format_cap_remove_single);
    	AST_TEST_UNREGISTER(format_cap_remove_multiple);
    	AST_TEST_UNREGISTER(format_cap_remove_bytype);
    	AST_TEST_UNREGISTER(format_cap_remove_all);
    	AST_TEST_UNREGISTER(format_cap_get_names);
    	AST_TEST_UNREGISTER(format_cap_get_compatible_format);
    	AST_TEST_UNREGISTER(format_cap_iscompatible_format);
    	AST_TEST_UNREGISTER(format_cap_get_compatible);
    	AST_TEST_UNREGISTER(format_cap_iscompatible);
    	AST_TEST_UNREGISTER(format_cap_best_by_type);
    	AST_TEST_UNREGISTER(format_cap_replace_from_cap);
    	return 0;
    }
    
    static int load_module(void)
    {
    	AST_TEST_REGISTER(format_cap_alloc);
    	AST_TEST_REGISTER(format_cap_append_single);
    	AST_TEST_REGISTER(format_cap_append_multiple);
    	AST_TEST_REGISTER(format_cap_append_all_unknown);
    	AST_TEST_REGISTER(format_cap_append_all_audio);
    	AST_TEST_REGISTER(format_cap_append_duplicate);
    	AST_TEST_REGISTER(format_cap_append_from_cap);
    	AST_TEST_REGISTER(format_cap_append_from_cap_duplicate);
    	AST_TEST_REGISTER(format_cap_set_framing);
    	AST_TEST_REGISTER(format_cap_remove_single);
    	AST_TEST_REGISTER(format_cap_remove_multiple);
    	AST_TEST_REGISTER(format_cap_remove_bytype);
    	AST_TEST_REGISTER(format_cap_remove_all);
    	AST_TEST_REGISTER(format_cap_get_names);
    	AST_TEST_REGISTER(format_cap_get_compatible_format);
    	AST_TEST_REGISTER(format_cap_iscompatible_format);
    	AST_TEST_REGISTER(format_cap_get_compatible);
    	AST_TEST_REGISTER(format_cap_iscompatible);
    	AST_TEST_REGISTER(format_cap_best_by_type);
    	AST_TEST_REGISTER(format_cap_replace_from_cap);
    	ast_codec_register(&test_law);
    	ast_format_interface_register("test_law", &test_law_interface);
    	return AST_MODULE_LOAD_SUCCESS;
    }
    
    AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Format capabilities API test module");