diff options
author | Nick Mathewson <nickm@torproject.org> | 2004-07-16 23:33:42 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2004-07-16 23:33:42 +0000 |
commit | df3544422c35f85cc9990b78a3a5e3ec3c5b67a0 (patch) | |
tree | b614919048f1c97b1be44606017daaa4c36ddc0e /src/or/test.c | |
parent | 10407625312cb43e92ef68f9b98a6b0aaa23a22b (diff) | |
download | tor-df3544422c35f85cc9990b78a3a5e3ec3c5b67a0.tar.gz tor-df3544422c35f85cc9990b78a3a5e3ec3c5b67a0.zip |
Change rule from "reject non-recommended versions" to "reject obsolete versions". A version is "obsolete" if it is non-recommended, and at least one recommended version is newer than it.
svn:r2052
Diffstat (limited to 'src/or/test.c')
-rw-r--r-- | src/or/test.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/src/or/test.c b/src/or/test.c index d92a459872..1acd13f183 100644 --- a/src/or/test.c +++ b/src/or/test.c @@ -647,7 +647,7 @@ test_onion_handshake() { } /* from routerparse.c */ -int is_recommended_version(const char *myversion, const char *start); +int is_obsolete_version(const char *myversion, const char *start); void test_dir_format() @@ -816,16 +816,6 @@ test_dir_format() tor_free(dir1); /* XXXX And more !*/ tor_free(dir2); /* And more !*/ - /* make sure is_recommended_version() works */ - test_eq(1, is_recommended_version("abc", "abc")); - test_eq(1, is_recommended_version("abc", "ab,abd,abde,abc,abcde")); - test_eq(1, is_recommended_version("abc", "ab,abd,abde,abcde,abc")); - test_eq(1, is_recommended_version("abc", "abc,abd,abde,abc,abcde")); - test_eq(1, is_recommended_version("a", "a,ab,abd,abde,abc,abcde")); - test_eq(0, is_recommended_version("a", "ab,abd,abde,abc,abcde")); - test_eq(0, is_recommended_version("abb", "ab,abd,abde,abc,abcde")); - test_eq(0, is_recommended_version("a", "")); - /* Try out version parsing functionality */ test_eq(0, tor_version_parse("0.3.4pre2-cvs", &ver1)); test_eq(0, ver1.major); @@ -855,6 +845,16 @@ test_dir_format() test_eq(VER_RELEASE, ver1.status); test_eq(999, ver1.patchlevel); test_eq(IS_NOT_CVS, ver1.cvs); + + /* make sure is_obsolete_version() works */ + test_eq(1, is_obsolete_version("0.0.1", "Tor 0.0.2")); + test_eq(1, is_obsolete_version("0.0.1", "0.0.2, Tor 0.0.3")); + test_eq(1, is_obsolete_version("0.0.1", "0.0.2,Tor 0.0.3")); + test_eq(1, is_obsolete_version("0.0.1", "0.0.3,BetterTor 0.0.1")); + test_eq(0, is_obsolete_version("0.0.2", "Tor 0.0.2,Tor 0.0.3")); + test_eq(1, is_obsolete_version("0.0.2", "Tor 0.0.2pre1,Tor 0.0.3")); + test_eq(0, is_obsolete_version("0.1.0", "Tor 0.0.2,Tor 0.0.3")); + test_eq(0, is_obsolete_version("0.0.7rc2", "0.0.7,Tor 0.0.7rc2,Tor 0.0.8")); } void test_rend_fns() |