[svn:parrot] r41843 - branches/pcc_optimize_sig/t/pmc
chromatic at svn.parrot.org
chromatic at svn.parrot.org
Tue Oct 13 19:58:45 UTC 2009
Author: chromatic
Date: Tue Oct 13 19:58:44 2009
New Revision: 41843
URL: https://trac.parrot.org/parrot/changeset/41843
Log:
[t] Added CallSignature tests for storing all indexed values in a single array
(or at least appearing that way) and destructive access via shift VTABLE entry.
Modified:
branches/pcc_optimize_sig/t/pmc/callsignature.t
Modified: branches/pcc_optimize_sig/t/pmc/callsignature.t
==============================================================================
--- branches/pcc_optimize_sig/t/pmc/callsignature.t Tue Oct 13 19:58:40 2009 (r41842)
+++ branches/pcc_optimize_sig/t/pmc/callsignature.t Tue Oct 13 19:58:44 2009 (r41843)
@@ -19,14 +19,15 @@
.sub 'main' :main
.include 'test_more.pir'
- plan(15)
+ plan(34)
test_instantiate()
test_get_set_attrs()
test_push_pop_indexed_access()
+ test_shift_unshift_indexed_access()
+ test_indexed_access()
.end
-
.sub 'test_instantiate'
$P0 = new ['CallSignature']
ok(1, 'Instantiated CallSignature')
@@ -85,6 +86,82 @@
is( $S0, 'hello', 'push_string/pop_string pair' )
.end
+.sub 'test_shift_unshift_indexed_access'
+ $P0 = new [ 'CallSignature' ]
+ $P1 = new [ 'Integer' ]
+ $P1 = 100
+
+ unshift $P0, $P1
+ $P2 = $P0[0]
+ is( $P2, 100, 'unshift_pmc/get_pmc_keyed_int pair' )
+ $P2 = shift $P0
+ is( $P2, 100, 'unshift_pmc/shift_pmc pair' )
+
+ unshift $P0, 200
+ $I0 = $P0[0]
+ is( $I0, 200, 'unshift_integer/get_integer_keyed_int pair' )
+ $I0 = shift $P0
+ is( $I0, 200, 'unshift_integer/shift_integer pair' )
+
+ unshift $P0, 3.03
+ $N0 = $P0[0]
+ is( $N0, 3.03, 'unshift_number/get_number_keyed_int pair' )
+ $N0 = shift $P0
+ is( $N0, 3.03, 'unshift_number/shift_number pair' )
+
+ unshift $P0, 'hello'
+ $S0 = $P0[0]
+ is( $S0, 'hello', 'unshift_string/get_string_keyed_int pair' )
+ $S0 = shift $P0
+ is( $S0, 'hello', 'unshift_string/shift_string pair' )
+.end
+
+.sub 'test_indexed_access'
+ $P0 = new [ 'CallSignature' ]
+ $P0[0] = 100
+ $P0[1] = 1.11
+
+ $S0 = '2.22'
+ $P0[2] = $S0
+
+ $P1 = new [ 'Float' ]
+ $P1 = 3.33
+ $P0[3] = $P1
+
+ $I1 = $P0[0]
+ is( $I1, 100, 'set_integer_indexed_int/get_integer_indexed_int pair' )
+
+ $N1 = $P0[1]
+ is( $N1, 1.11, 'set_number_indexed_int/get_number_indexed_int pair' )
+
+ $S1 = $P0[2]
+ is( $S1, '2.22', 'set_string_indexed_int/get_string_indexed_int pair' )
+
+ $P1 = $P0[3]
+ is( $P1, 3.33, 'set_pmc_indexed_int/get_pmc_indexed_int pair' )
+
+ $I1 = shift $P0
+ is( $I1, 100, 'set_integer_indexed_int/shift_integer pair' )
+
+ $N1 = $P0[0]
+ is( $N1, 1.11, 'shift_* should remove elements from array' )
+
+ $N1 = shift $P0
+ is( $N1, 1.11, 'set_number_indexed_int/shift_number pair' )
+
+ $S1 = $P0[0]
+ is( $S1, '2.22', 'shift_* should remove elements from array' )
+
+ $S1 = shift $P0
+ is( $S1, '2.22', 'set_string_indexed_int/shift_string pair' )
+
+ $P1 = $P0[0]
+ is( $P1, 3.33, 'shift_* should remove elements from array' )
+
+ $P1 = shift $P0
+ is( $P1, 3.33, 'set_pmc_indexed_int/shift_pmc pair' )
+.end
+
# Local Variables:
# mode: pir
# fill-column: 100
More information about the parrot-commits
mailing list