aboutsummaryrefslogtreecommitdiff
path: root/src/or/test.c
diff options
context:
space:
mode:
authorRoger Dingledine <arma@torproject.org>2003-08-23 10:09:25 +0000
committerRoger Dingledine <arma@torproject.org>2003-08-23 10:09:25 +0000
commit36f055e7ee7975fa6982cdfef8409b7a303166c5 (patch)
tree25c71ce947f9079be7fa2c55e5d0c9eef7a7cb34 /src/or/test.c
parent33b0569fba5a098e3aa25c50397ca59a0d63bb4a (diff)
downloadtor-36f055e7ee7975fa6982cdfef8409b7a303166c5.tar
tor-36f055e7ee7975fa6982cdfef8409b7a303166c5.tar.gz
start honoring the recommended_versions string
your client exits if you're running a version not in the directory's list of acceptable versions (unless you have a config variable set to override). svn:r408
Diffstat (limited to 'src/or/test.c')
-rw-r--r--src/or/test.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/or/test.c b/src/or/test.c
index 3d769c39a..547f73a07 100644
--- a/src/or/test.c
+++ b/src/or/test.c
@@ -485,6 +485,9 @@ test_onion_handshake() {
int dump_router_to_string(char *s, int maxlen, routerinfo_t *router);
void dump_directory_to_string(char *s, int maxlen);
+/* from routers.c */
+int compare_recommended_versions(char *myversion, char *start);
+
void
test_dir_format()
{
@@ -608,6 +611,17 @@ test_dir_format()
if (rp2) routerinfo_free(rp2);
if (dir1) free(dir1); /* And more !*/
if (dir1) free(dir2); /* And more !*/
+
+ /* make sure compare_recommended_versions() works */
+ test_eq(0, compare_recommended_versions("abc", "abc"));
+ test_eq(0, compare_recommended_versions("abc", "ab,abd,abde,abc,abcde"));
+ test_eq(0, compare_recommended_versions("abc", "ab,abd,abde,abcde,abc"));
+ test_eq(0, compare_recommended_versions("abc", "abc,abd,abde,abc,abcde"));
+ test_eq(0, compare_recommended_versions("a", "a,ab,abd,abde,abc,abcde"));
+ test_eq(-1, compare_recommended_versions("a", "ab,abd,abde,abc,abcde"));
+ test_eq(-1, compare_recommended_versions("abb", "ab,abd,abde,abc,abcde"));
+ test_eq(-1, compare_recommended_versions("a", ""));
+ test_eq(0, compare_recommended_versions(VERSION, RECOMMENDED_SOFTWARE_VERSIONS));
}
int