Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(68)

Unified Diff: test/roc_driver.c

Issue 2344973002: Update libsrtp to version 2.0 (Closed)
Patch Set: Add '.' back to include_dirs Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « test/replay_driver.c ('k') | test/rtp.c » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/roc_driver.c
diff --git a/srtp/test/roc_driver.c b/test/roc_driver.c
similarity index 84%
rename from srtp/test/roc_driver.c
rename to test/roc_driver.c
index 6fdc6f197bbb4d9ccdafbf13430734d2794d25ee..70e16b4d5033bbaeb63e8c60dbcc3323ffdb9269 100644
--- a/srtp/test/roc_driver.c
+++ b/test/roc_driver.c
@@ -52,7 +52,7 @@
/*
* defining ROC_TEST causes small datatypes to be used in
- * xtd_seq_num_t - this allows the functions to be exhaustively tested.
+ * srtp_xtd_seq_num_t - this allows the functions to be exhaustively tested.
*/
#if ROC_NEEDS_TO_BE_TESTED
#define ROC_TEST
@@ -61,12 +61,12 @@
#include "rdbx.h"
#include "ut_sim.h"
-err_status_t
+srtp_err_status_t
roc_test(int num_trials);
int
main (void) {
- err_status_t status;
+ srtp_err_status_t status;
printf("rollover counter test driver\n"
"David A. McGrew\n"
@@ -85,22 +85,22 @@ main (void) {
#define ROC_VERBOSE 0
-err_status_t
+srtp_err_status_t
roc_test(int num_trials) {
- xtd_seq_num_t local, est, ref;
+ srtp_xtd_seq_num_t local, est, ref;
ut_connection utc;
int i, num_bad_est = 0;
int delta;
uint32_t ircvd;
double failure_rate;
- index_init(&local);
- index_init(&ref);
- index_init(&est);
+ srtp_index_init(&local);
+ srtp_index_init(&ref);
+ srtp_index_init(&est);
printf("\n\ttesting sequential insertion...");
for (i=0; i < 2048; i++) {
- delta = index_guess(&local, &est, (uint16_t) ref);
+ delta = srtp_index_guess(&local, &est, (uint16_t) ref);
#if ROC_VERBOSE
printf("%lld, %lld, %d\n", ref, est, i);
#endif
@@ -110,21 +110,21 @@ roc_test(int num_trials) {
#endif
++num_bad_est;
}
- index_advance(&ref, 1);
+ srtp_index_advance(&ref, 1);
}
failure_rate = (double) num_bad_est / num_trials;
if (failure_rate > 0.01) {
printf("error: failure rate too high (%d bad estimates in %d trials)\n",
num_bad_est, num_trials);
- return err_status_algo_fail;
+ return srtp_err_status_algo_fail;
}
printf("done\n");
printf("\ttesting non-sequential insertion...");
- index_init(&local);
- index_init(&ref);
- index_init(&est);
+ srtp_index_init(&local);
+ srtp_index_init(&ref);
+ srtp_index_init(&est);
ut_init(&utc);
for (i=0; i < num_trials; i++) {
@@ -136,7 +136,7 @@ roc_test(int num_trials) {
ref = ircvd;
/* estimate index based on low bits of ircvd */
- delta = index_guess(&local, &est, (uint16_t) ref);
+ delta = srtp_index_guess(&local, &est, (uint16_t) ref);
#if ROC_VERBOSE
printf("ref: %lld, local: %lld, est: %lld, ircvd: %d, delta: %d\n",
ref, local, est, ircvd, delta);
@@ -145,12 +145,12 @@ roc_test(int num_trials) {
if (local + delta != est) {
printf(" *bad delta*: local %llu + delta %d != est %llu\n",
(unsigned long long)local, delta, (unsigned long long)est);
- return err_status_algo_fail;
+ return srtp_err_status_algo_fail;
}
- /* now update local xtd_seq_num_t as necessary */
+ /* now update local srtp_xtd_seq_num_t as necessary */
if (delta > 0)
- index_advance(&local, delta);
+ srtp_index_advance(&local, delta);
if (ref != est) {
#if ROC_VERBOSE
@@ -167,9 +167,9 @@ roc_test(int num_trials) {
if (failure_rate > 0.01) {
printf("error: failure rate too high (%d bad estimates in %d trials)\n",
num_bad_est, num_trials);
- return err_status_algo_fail;
+ return srtp_err_status_algo_fail;
}
printf("done\n");
- return err_status_ok;
+ return srtp_err_status_ok;
}
« no previous file with comments | « test/replay_driver.c ('k') | test/rtp.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698