dovecot-1.2-sieve: Testsuite: added a few more tests for the i;a...

pigeonhole at rename-it.nl pigeonhole at rename-it.nl
Sun Jan 24 12:20:56 EET 2010


details:   http://hg.rename-it.nl/dovecot-1.2-sieve/rev/d2cbfb2d4981
changeset: 1221:d2cbfb2d4981
user:      Stephan Bosch <stephan at rename-it.nl>
date:      Sun Jan 24 11:15:38 2010 +0100
description:
Testsuite: added a few more tests for the i;ascii-numeric comparator (patch by Julian Cowley).

diffstat:

 tests/extensions/relational/comparators.svtest |  107 ++++++++++++++++++++++----
 1 files changed, 88 insertions(+), 19 deletions(-)

diffs (161 lines):

diff -r 0ceabefd8360 -r d2cbfb2d4981 tests/extensions/relational/comparators.svtest
--- a/tests/extensions/relational/comparators.svtest	Sat Jan 23 00:37:21 2010 +0100
+++ b/tests/extensions/relational/comparators.svtest	Sun Jan 24 11:15:38 2010 +0100
@@ -3,6 +3,10 @@
 require "relational";
 require "comparator-i;ascii-numeric";
 
+/*
+ * Comparator i;octet
+ */
+
 test "i;octet" {
 	if not string :comparator "i;octet" :value "eq" "" "" {
 		test_fail "not '' eq ''";
@@ -57,6 +61,10 @@
     }
 }
 
+/*
+ * Comparator i;ascii-casemap
+ */
+
 test "i;ascii-casemap" {
 	if not string :comparator "i;ascii-casemap" :value "eq" "" "" {
 		test_fail "not '' eq ''";
@@ -111,7 +119,13 @@
     }
 }
 
+/*
+ * Comparator i;ascii-numeric
+ */
+
 test "i;ascii-numeric" {
+	/* Non-digit characters; equality */
+
 	if not string :comparator "i;ascii-numeric" :value "eq" "" "" {
 		test_fail "not '' eq ''";
 	}
@@ -132,9 +146,83 @@
 		test_fail "not 'b' eq 'a'";
 	}
 
+	if string :comparator "i;ascii-numeric" :value "eq" "a" "0" {
+		test_fail "'a' eq '0'";
+	}
+
+	if string :comparator "i;ascii-numeric" :value "eq" "0" "a" {
+		test_fail "'0' eq 'a'";
+	}
+
+	if not string :comparator "i;ascii-numeric" :value "ne" "a" "0" {
+		test_fail "not 'a' ne '0'";
+	}
+
+	if not string :comparator "i;ascii-numeric" :value "ne" "0" "a" {
+		test_fail "not '0' ne 'a'";
+	}
+
+	/* Non-digit characters; comparison */
+
+	if string :comparator "i;ascii-numeric" :value "lt" "a" "0" {
+		test_fail "'a' lt '0'";
+	}
+
+	if not string :comparator "i;ascii-numeric" :value "lt" "0" "a" {
+		test_fail "not '0' lt 'a'";
+	}
+
+	if not string :comparator "i;ascii-numeric" :value "gt" "a" "0" {
+		test_fail "not 'a' gt '0'";
+	}
+
+	if string :comparator "i;ascii-numeric" :value "gt" "0" "a" {
+		test_fail "'0' gt 'a'";
+	}
+
+	if not string :comparator "i;ascii-numeric" :value "ge" "a" "0" {
+		test_fail "not 'a' ge '0'";
+	}
+
+	if string :comparator "i;ascii-numeric" :value "ge" "0" "a" {
+		test_fail "'0' ge 'a'";
+	}
+
+	if string :comparator "i;ascii-numeric" :value "le" "a" "0" {
+		test_fail "'a' le '0'";
+	}
+
+	if not string :comparator "i;ascii-numeric" :value "le" "0" "a" {
+		test_fail "not '0' le 'a'";
+	}
+
 	if not string :comparator "i;ascii-numeric" :value "eq" "0" "0" {
 		test_fail "not '0' eq '0'";
 	}
+	
+	/* Digit characters; basic comparison */
+
+	if not string :comparator "i;ascii-numeric" :value "eq" "2" "2" {
+		test_fail "not '2' eq '2'";
+	}
+
+	if not string :comparator "i;ascii-numeric" :value "gt" "2" "1" {
+		test_fail "not '2' gt '1'";
+	}	
+
+	if not string :comparator "i;ascii-numeric" :value "lt" "1" "2" {
+		test_fail "not '1' lt '2'";
+	}
+
+	if not string :comparator "i;ascii-numeric" :value "lt" "65535" "65635" {
+		test_fail "not '65535' lt '65635'";
+	}
+
+	if not string :comparator "i;ascii-numeric" :value "gt" "65635" "65535" {
+		test_fail "not '65635' gt '65535'";
+	}	
+
+	/* Digit characters; leading zeros */
 
 	if not string :comparator "i;ascii-numeric" :value "eq" "0" "000" {
 		test_fail "not '0' eq '000'";
@@ -144,10 +232,6 @@
 		test_fail "not '0' eq '000'";
 	}	
 
-	if not string :comparator "i;ascii-numeric" :value "eq" "2" "2" {
-		test_fail "not '2' eq '2'";
-	}	
-
 	if not string :comparator "i;ascii-numeric" :value "eq" "02" "0002" {
 		test_fail "not '02' eq '0002'";
 	}	
@@ -156,14 +240,6 @@
 		test_fail "not '0002' eq '02'";
 	}	
 
-	if not string :comparator "i;ascii-numeric" :value "gt" "2" "1" {
-		test_fail "not '2' gt '1'";
-	}	
-
-	if not string :comparator "i;ascii-numeric" :value "lt" "1" "2" {
-		test_fail "not '1' lt '2'";
-	}	
-
 	if not string :comparator "i;ascii-numeric" :value "gt" "2" "001" {
 		test_fail "not '2' gt '001'";
 	}	
@@ -179,11 +255,4 @@
 	if not string :comparator "i;ascii-numeric" :value "lt" "1" "002" {
 		test_fail "not '1' lt '002'";
 	}	
-
-	if not string :comparator "i;ascii-numeric" :value "lt" "65535" "65635" {
-		test_fail "not '65535' lt '65635'";
-	}	
-	if not string :comparator "i;ascii-numeric" :value "gt" "65635" "65535" {
-		test_fail "not '65635' gt '65535'";
-	}	
 }


More information about the dovecot-cvs mailing list