[svn:parrot] r48534 - branches/substr_eq_at/t/op
pmichaud at svn.parrot.org
pmichaud at svn.parrot.org
Mon Aug 16 19:52:24 UTC 2010
Author: pmichaud
Date: Mon Aug 16 19:52:23 2010
New Revision: 48534
URL: https://trac.parrot.org/parrot/changeset/48534
Log:
[str]: Added some (failing) tests for experimental cmp_str_at with mixed unicode+ascii operands.
Modified:
branches/substr_eq_at/t/op/substr_cmp.t
Modified: branches/substr_eq_at/t/op/substr_cmp.t
==============================================================================
--- branches/substr_eq_at/t/op/substr_cmp.t Mon Aug 16 19:28:18 2010 (r48533)
+++ branches/substr_eq_at/t/op/substr_cmp.t Mon Aug 16 19:52:23 2010 (r48534)
@@ -19,62 +19,227 @@
.sub main :main
.include 'test_more.pir'
- plan(16)
+ plan(68)
- test_cmp_str_at_i_s_sc_ic_ic()
+ test_cmp_str_at_i_s_sc_ic_ic_ascii_ascii()
+ test_cmp_str_at_i_s_sc_ic_ic_ascii_unicode()
+ test_cmp_str_at_i_s_sc_ic_ic_unicode_ascii()
+ test_cmp_str_at_i_s_sc_ic_ic_unicode_unicode()
.end
-.sub 'test_cmp_str_at_i_s_sc_ic_ic'
- set $S0, 'my def = Int'
- $I0 = cmp_str_at $S0, 'my', 0, 2
+.sub 'test_cmp_str_at_i_s_sc_ic_ic_ascii_ascii'
+ set $S0, "my def = Int"
+ $I0 = cmp_str_at $S0, "my", 0, 2
is( $I0, 0, "eq comparison at beginning" )
- $I0 = cmp_str_at $S0, 'has', 0, 3
+ $I0 = cmp_str_at $S0, "has", 0, 3
isnt( $I0, 0, "ne comparison at beginning " )
- $I0 = cmp_str_at $S0, 'def', 3, 3
+ $I0 = cmp_str_at $S0, "def", 3, 3
is( $I0, 0, "eq comparison at offset 3" )
- $I0 = cmp_str_at $S0, 'abc', 3, 3
+ $I0 = cmp_str_at $S0, "abc", 3, 3
is( $I0, 1, "gt comparison at offset 3" )
- $I0 = cmp_str_at $S0, 'xyz', 3, 3
+ $I0 = cmp_str_at $S0, "xyz", 3, 3
is( $I0, -1, "lt comparison at offset 3" )
- $I0 = cmp_str_at $S0, 'Int', 9, 3
+ $I0 = cmp_str_at $S0, "Int", 9, 3
is( $I0, 0, "eq comparison at end" )
- $I0 = cmp_str_at $S0, 'Integer', 9, 7
+ $I0 = cmp_str_at $S0, "Integer", 9, 7
is( $I0, -1, "short comparison at end" )
- $I0 = cmp_str_at $S0, 'Integer', 9, 3
+ $I0 = cmp_str_at $S0, "Integer", 9, 3
is( $I0, 0, "short comparison of both strings" )
- $I0 = cmp_str_at $S0, 'Float', 9, 5
+ $I0 = cmp_str_at $S0, "Float", 9, 5
is( $I0, 1, "short gt comparison at end" )
- $I0 = cmp_str_at $S0, 'Float', 9, 1
+ $I0 = cmp_str_at $S0, "Float", 9, 1
is( $I0, 1, "short gt comparison of both strings" )
- $I0 = cmp_str_at $S0, 'Float', 9, 0
+ $I0 = cmp_str_at $S0, "Float", 9, 0
is( $I0, 0, "length of zero is always eq" )
- $I0 = cmp_str_at $S0, 'de', 3, 3
+ $I0 = cmp_str_at $S0, "de", 3, 3
is( $I0, 1, "2nd argument is short" )
- $I0 = cmp_str_at $S0, 'ab', 3, 3
+ $I0 = cmp_str_at $S0, "ab", 3, 3
is( $I0, 1, "2nd argument is short" )
- $I0 = cmp_str_at $S0, 'xy', 3, 3
+ $I0 = cmp_str_at $S0, "xy", 3, 3
is( $I0, -1, "2nd argument is short" )
- $I0 = cmp_str_at $S0, '', 0, 0
+ $I0 = cmp_str_at $S0, "", 0, 0
is( $I0, 0, "2nd argument is empty" )
- $I0 = cmp_str_at $S0, 'my def = Integer', 0, 16
+ $I0 = cmp_str_at $S0, "my def = Integer", 0, 16
is( $I0, -1, "2nd argument is longer" )
- $I0 = cmp_str_at $S0, 'my def = Integer', 15, 1
+ $I0 = cmp_str_at $S0, "my def = Integer", 15, 1
+ is( $I0, -1, "offset out of bounds of first string" )
+.end
+
+.sub 'test_cmp_str_at_i_s_sc_ic_ic_ascii_unicode'
+ set $S0, "my def = Int"
+ $I0 = cmp_str_at $S0, unicode:"my", 0, 2
+ is( $I0, 0, "eq comparison at beginning" )
+
+ $I0 = cmp_str_at $S0, unicode:"has", 0, 3
+ isnt( $I0, 0, "ne comparison at beginning " )
+
+ $I0 = cmp_str_at $S0, unicode:"def", 3, 3
+ is( $I0, 0, "eq comparison at offset 3" )
+
+ $I0 = cmp_str_at $S0, unicode:"abc", 3, 3
+ is( $I0, 1, "gt comparison at offset 3" )
+
+ $I0 = cmp_str_at $S0, unicode:"xyz", 3, 3
+ is( $I0, -1, "lt comparison at offset 3" )
+
+ $I0 = cmp_str_at $S0, unicode:"Int", 9, 3
+ is( $I0, 0, "eq comparison at end" )
+
+ $I0 = cmp_str_at $S0, unicode:"Integer", 9, 7
+ is( $I0, -1, "short comparison at end" )
+
+ $I0 = cmp_str_at $S0, unicode:"Integer", 9, 3
+ is( $I0, 0, "short comparison of both strings" )
+
+ $I0 = cmp_str_at $S0, unicode:"Float", 9, 5
+ is( $I0, 1, "short gt comparison at end" )
+
+ $I0 = cmp_str_at $S0, unicode:"Float", 9, 1
+ is( $I0, 1, "short gt comparison of both strings" )
+
+ $I0 = cmp_str_at $S0, unicode:"Float", 9, 0
+ is( $I0, 0, "length of zero is always eq" )
+
+ $I0 = cmp_str_at $S0, unicode:"de", 3, 3
+ is( $I0, 1, "2nd argument is short" )
+
+ $I0 = cmp_str_at $S0, unicode:"ab", 3, 3
+ is( $I0, 1, "2nd argument is short" )
+
+ $I0 = cmp_str_at $S0, unicode:"xy", 3, 3
+ is( $I0, -1, "2nd argument is short" )
+
+ $I0 = cmp_str_at $S0, unicode:"", 0, 0
+ is( $I0, 0, "2nd argument is empty" )
+
+ $I0 = cmp_str_at $S0, unicode:"my def = Integer", 0, 16
+ is( $I0, -1, "2nd argument is longer" )
+
+ $I0 = cmp_str_at $S0, unicode:"my def = Integer", 15, 1
+ is( $I0, -1, "offset out of bounds of first string" )
+.end
+
+.sub 'test_cmp_str_at_i_s_sc_ic_ic_unicode_ascii'
+ set $S0, unicode:"my def = Int"
+ $I0 = cmp_str_at $S0, "my", 0, 2
+ is( $I0, 0, "eq comparison at beginning" )
+
+ $I0 = cmp_str_at $S0, "has", 0, 3
+ isnt( $I0, 0, "ne comparison at beginning " )
+
+ $I0 = cmp_str_at $S0, "def", 3, 3
+ is( $I0, 0, "eq comparison at offset 3" )
+
+ $I0 = cmp_str_at $S0, "abc", 3, 3
+ is( $I0, 1, "gt comparison at offset 3" )
+
+ $I0 = cmp_str_at $S0, "xyz", 3, 3
+ is( $I0, -1, "lt comparison at offset 3" )
+
+ $I0 = cmp_str_at $S0, "Int", 9, 3
+ is( $I0, 0, "eq comparison at end" )
+
+ $I0 = cmp_str_at $S0, "Integer", 9, 7
+ is( $I0, -1, "short comparison at end" )
+
+ $I0 = cmp_str_at $S0, "Integer", 9, 3
+ is( $I0, 0, "short comparison of both strings" )
+
+ $I0 = cmp_str_at $S0, "Float", 9, 5
+ is( $I0, 1, "short gt comparison at end" )
+
+ $I0 = cmp_str_at $S0, "Float", 9, 1
+ is( $I0, 1, "short gt comparison of both strings" )
+
+ $I0 = cmp_str_at $S0, "Float", 9, 0
+ is( $I0, 0, "length of zero is always eq" )
+
+ $I0 = cmp_str_at $S0, "de", 3, 3
+ is( $I0, 1, "2nd argument is short" )
+
+ $I0 = cmp_str_at $S0, "ab", 3, 3
+ is( $I0, 1, "2nd argument is short" )
+
+ $I0 = cmp_str_at $S0, "xy", 3, 3
+ is( $I0, -1, "2nd argument is short" )
+
+ $I0 = cmp_str_at $S0, "", 0, 0
+ is( $I0, 0, "2nd argument is empty" )
+
+ $I0 = cmp_str_at $S0, "my def = Integer", 0, 16
+ is( $I0, -1, "2nd argument is longer" )
+
+ $I0 = cmp_str_at $S0, "my def = Integer", 15, 1
+ is( $I0, -1, "offset out of bounds of first string" )
+.end
+
+.sub 'test_cmp_str_at_i_s_sc_ic_ic_unicode_unicode'
+ set $S0, unicode:"my def = Int"
+ $I0 = cmp_str_at $S0, unicode:"my", 0, 2
+ is( $I0, 0, "eq comparison at beginning" )
+
+ $I0 = cmp_str_at $S0, unicode:"has", 0, 3
+ isnt( $I0, 0, "ne comparison at beginning " )
+
+ $I0 = cmp_str_at $S0, unicode:"def", 3, 3
+ is( $I0, 0, "eq comparison at offset 3" )
+
+ $I0 = cmp_str_at $S0, unicode:"abc", 3, 3
+ is( $I0, 1, "gt comparison at offset 3" )
+
+ $I0 = cmp_str_at $S0, unicode:"xyz", 3, 3
+ is( $I0, -1, "lt comparison at offset 3" )
+
+ $I0 = cmp_str_at $S0, unicode:"Int", 9, 3
+ is( $I0, 0, "eq comparison at end" )
+
+ $I0 = cmp_str_at $S0, unicode:"Integer", 9, 7
+ is( $I0, -1, "short comparison at end" )
+
+ $I0 = cmp_str_at $S0, unicode:"Integer", 9, 3
+ is( $I0, 0, "short comparison of both strings" )
+
+ $I0 = cmp_str_at $S0, unicode:"Float", 9, 5
+ is( $I0, 1, "short gt comparison at end" )
+
+ $I0 = cmp_str_at $S0, unicode:"Float", 9, 1
+ is( $I0, 1, "short gt comparison of both strings" )
+
+ $I0 = cmp_str_at $S0, unicode:"Float", 9, 0
+ is( $I0, 0, "length of zero is always eq" )
+
+ $I0 = cmp_str_at $S0, unicode:"de", 3, 3
+ is( $I0, 1, "2nd argument is short" )
+
+ $I0 = cmp_str_at $S0, unicode:"ab", 3, 3
+ is( $I0, 1, "2nd argument is short" )
+
+ $I0 = cmp_str_at $S0, unicode:"xy", 3, 3
+ is( $I0, -1, "2nd argument is short" )
+
+ $I0 = cmp_str_at $S0, unicode:"", 0, 0
+ is( $I0, 0, "2nd argument is empty" )
+
+ $I0 = cmp_str_at $S0, unicode:"my def = Integer", 0, 16
+ is( $I0, -1, "2nd argument is longer" )
+
+ $I0 = cmp_str_at $S0, unicode:"my def = Integer", 15, 1
is( $I0, -1, "offset out of bounds of first string" )
.end
More information about the parrot-commits
mailing list