summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMichael Jennings <mej@kainx.org>2002-07-14 03:31:38 +0000
committerMichael Jennings <mej@kainx.org>2002-07-14 03:31:38 +0000
commit0b1d8ad509b3e9b353fa96954ba0abf38bb9d843 (patch)
treeba9d57204a6fe1a26ff8a96f2a490ed36e90d322 /test
parenta5f7c5eac03b9806627433d8d52563ebedd2d056 (diff)
downloadlibast-0b1d8ad509b3e9b353fa96954ba0abf38bb9d843.tar.gz
Sat Jul 13 23:26:12 2002 Michael Jennings (mej)
New function, version_compare(), which accurately compares package version numbers. Take a look at the various test cases to see what kinds of comparisons it can accurately make, and if you see any that aren't there, let me know. SVN revision: 6339
Diffstat (limited to 'test')
-rw-r--r--test/test.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/test.c b/test/test.c
index 0e325a3..8d60dd7 100644
--- a/test/test.c
+++ b/test/test.c
@@ -221,6 +221,24 @@ test_strings(void)
free_array(SPIF_CAST(ptr) slist, 5);
TEST_PASS();
+ TEST_BEGIN("version_compare() function");
+ TEST_FAIL_IF(!SPIF_CMP_IS_LESS(version_compare("1.0", "1.0.1")));
+ TEST_FAIL_IF(!SPIF_CMP_IS_LESS(version_compare("2.9.99", "3.0")));
+ TEST_FAIL_IF(!SPIF_CMP_IS_LESS(version_compare("3.0", "29.9.9")));
+ TEST_FAIL_IF(!SPIF_CMP_IS_LESS(version_compare("1.0pre2", "1.0")));
+ TEST_FAIL_IF(!SPIF_CMP_IS_GREATER(version_compare("0.5.3", "0.5.3snap4")));
+ TEST_FAIL_IF(!SPIF_CMP_IS_GREATER(version_compare("2.2.4", "2.2.4beta3")));
+ TEST_FAIL_IF(!SPIF_CMP_IS_GREATER(version_compare("2.2.4beta3", "2.2.4alpha7")));
+ TEST_FAIL_IF(!SPIF_CMP_IS_GREATER(version_compare("1.27.3", "1.13.1")));
+ TEST_FAIL_IF(!SPIF_CMP_IS_GREATER(version_compare("0.10", "0.9.2")));
+ TEST_FAIL_IF(!SPIF_CMP_IS_GREATER(version_compare("2.3.2a", "2.3.2")));
+ TEST_FAIL_IF(!SPIF_CMP_IS_GREATER(version_compare("4.0p1", "4.0")));
+ TEST_FAIL_IF(!SPIF_CMP_IS_EQUAL(version_compare("3.4.5", "3.4.5")));
+ TEST_FAIL_IF(!SPIF_CMP_IS_EQUAL(version_compare("1.2.0b3", "1.2.0b3")));
+ TEST_FAIL_IF(!SPIF_CMP_IS_EQUAL(version_compare("2.0alpha", "2.0alpha")));
+ TEST_FAIL_IF(!SPIF_CMP_IS_EQUAL(version_compare("5.4pre1", "5.4pre1")));
+ TEST_PASS();
+
TEST_PASSED("string");
return 0;
}