summaryrefslogtreecommitdiff
path: root/src/or/test.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2005-03-01 01:44:57 +0000
committerNick Mathewson <nickm@torproject.org>2005-03-01 01:44:57 +0000
commit83743d64abd478e9b4b5a0b3adf4e7aa22e6fc86 (patch)
treec7a385929ff0440d43bcaa97d484cac64c69ad78 /src/or/test.c
parentb7b05dc1b26c5d828cda618f2a27fa883b7bfb7e (diff)
downloadtor-83743d64abd478e9b4b5a0b3adf4e7aa22e6fc86.tar.gz
tor-83743d64abd478e9b4b5a0b3adf4e7aa22e6fc86.zip
Change version parsing logic: a version is "obsolete" if it is not recommended and (1) there is a newer recommended version in the same series, or (2) there are no recommended versions in the same series, but there are some recommended versions in a newer series. A version is "new" if it is newer than any recommended version in the same series.
svn:r3716
Diffstat (limited to 'src/or/test.c')
-rw-r--r--src/or/test.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/or/test.c b/src/or/test.c
index a30d43e969..3f743385d1 100644
--- a/src/or/test.c
+++ b/src/or/test.c
@@ -1239,11 +1239,22 @@ test_dir_format(void)
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.0.2", "Tor 0.0.2pre1,Tor 0.0.3"));
+ test_eq(1, is_obsolete_version("0.0.2", "Tor 0.0.2.1,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"));
test_eq(0, is_obsolete_version("0.0.5", "0.0.5-cvs"));
test_eq(0, is_obsolete_version("0.0.5.1-cvs", "0.0.5"));
+ /* Not on list, but newer than any in same series. */
+ test_eq(0, is_obsolete_version("0.1.0.3", "Tor 0.1.0.2,Tor 0.0.9.5,Tor 0.1.1.0"));
+ /* Series newer than any on list. */
+ test_eq(0, is_obsolete_version("0.1.1.3", "Tor 0.1.0.2,Tor 0.0.9.5,Tor 0.1.1.0"));
+ /* Series older than any on list. */
+ test_eq(1, is_obsolete_version("0.0.1.3", "Tor 0.1.0.2,Tor 0.0.9.5,Tor 0.1.1.0"));
+ /* Not on list, not newer than any on same series. */
+ test_eq(1, is_obsolete_version("0.1.0.1", "Tor 0.1.0.2,Tor 0.0.9.5,Tor 0.1.1.0"));
+ /* On list, not newer than any on same series. */
+ test_eq(1, is_obsolete_version("0.1.0.1", "Tor 0.1.0.2,Tor 0.0.9.5,Tor 0.1.1.0"));
test_eq(0, tor_version_as_new_as("Tor 0.0.5", "0.0.9pre1-cvs"));
test_eq(1, tor_version_as_new_as(