[svn:parrot] r37983 - branches/packfile_revamp/t/pmc
bacek at svn.parrot.org
bacek at svn.parrot.org
Wed Apr 8 23:43:16 UTC 2009
Author: bacek
Date: Wed Apr 8 23:43:16 2009
New Revision: 37983
URL: https://trac.parrot.org/parrot/changeset/37983
Log:
Add tests for PackfileConstantTable.set_*_int
Modified:
branches/packfile_revamp/t/pmc/packfileconstanttable.t
Modified: branches/packfile_revamp/t/pmc/packfileconstanttable.t
==============================================================================
--- branches/packfile_revamp/t/pmc/packfileconstanttable.t Wed Apr 8 23:42:56 2009 (r37982)
+++ branches/packfile_revamp/t/pmc/packfileconstanttable.t Wed Apr 8 23:43:16 2009 (r37983)
@@ -24,11 +24,12 @@
.sub 'main' :main
.include 'test_more.pir'
- 'plan'(3)
+ 'plan'(7)
'test_sanity'()
'test_elements'()
'test_get'()
+ 'test_set'()
.end
@@ -107,6 +108,34 @@
.return()
.end
+# Test setting constants into PackfileConstantTable
+.sub 'test_set'
+ .local pmc ct
+ .local int size
+ ct = new ['PackfileConstantTable']
+
+ # Initial PackfileConstantTable is empty
+ size = elements ct
+ is(size, 0, "Empty PackfileConstantTable created")
+
+ # Set first string
+ ct[0] = "string"
+ $I0 = elements ct
+ is($I0, 1, "String element added")
+
+ ct[1] = 1.0
+ $I0 = elements ct
+ is($I0, 2, "Number elements added")
+
+ $P0 = new 'Integer'
+ $P0 = 42
+ ct[2] = $P0
+ $I0 = elements ct
+ is($I0, 3, "PMC elements added")
+
+.end
+
+
# Return test filename
# Currently parrot doesn't support system independent PBCs. So, cross your
# fingers and try different filename for binary-dependent tests...
More information about the parrot-commits
mailing list