[or-cvs] Make unittests pass

Nick Mathewson nickm at seul.org
Mon Aug 9 04:26:27 UTC 2004


Update of /home/or/cvsroot/src/or
In directory moria.mit.edu:/tmp/cvs-serv8619/src/or

Modified Files:
	test.c 
Log Message:
Make unittests pass

Index: test.c
===================================================================
RCS file: /home/or/cvsroot/src/or/test.c,v
retrieving revision 1.107
retrieving revision 1.108
diff -u -d -r1.107 -r1.108
--- test.c	7 Aug 2004 02:46:16 -0000	1.107
+++ test.c	9 Aug 2004 04:26:25 -0000	1.108
@@ -673,6 +673,7 @@
   struct exit_policy_t ex1, ex2;
   routerlist_t *dir1 = NULL, *dir2 = NULL;
   tor_version_t ver1;
+  char *bw_lines = NULL;
 
   test_assert( (pk1 = crypto_new_pk_env()) );
   test_assert( (pk2 = crypto_new_pk_env()) );
@@ -723,6 +724,11 @@
   r2.exit_policy = &ex1;
   r2.nickname = "Fred";
 
+  bw_lines = rep_hist_get_bandwidth_lines();
+  test_assert(bw_lines);
+  test_assert(!strncmp(bw_lines, "opt write-history ",
+                       strlen("opt write-history ")));
+
   test_assert(!crypto_pk_write_public_key_to_string(pk1, &pk1_str,
                                                     &pk1_str_len));
   test_assert(!crypto_pk_write_public_key_to_string(pk2 , &pk2_str,
@@ -750,10 +756,12 @@
   strcat(buf2, pk1_str);
   strcat(buf2, "signing-key\n");
   strcat(buf2, pk2_str);
+  strcat(buf2, bw_lines);
   strcat(buf2, "router-signature\n");
   buf[strlen(buf2)] = '\0'; /* Don't compare the sig; it's never the same twice*/
 
   test_streq(buf, buf2);
+  tor_free(bw_lines);
 
   test_assert(router_dump_router_to_string(buf, 2048, &r1, pk2)>0);
   cp = buf;



More information about the tor-commits mailing list