Author: cotto
Date: Wed Jan 7 17:56:10 2009
New Revision: 35183
Modified:
trunk/t/pmc/addrregistry.t
trunk/t/pmc/boolean.t
trunk/t/pmc/bound_nci.t
trunk/t/pmc/callsignature.t
trunk/t/pmc/capture.t
trunk/t/pmc/class.t
trunk/t/pmc/closure.t
trunk/t/pmc/codestring.t
trunk/t/pmc/complex.t
Log:
[t] bracket more PMC names
Modified: trunk/t/pmc/addrregistry.t
==============================================================================
--- trunk/t/pmc/addrregistry.t (original)
+++ trunk/t/pmc/addrregistry.t Wed Jan 7 17:56:10 2009
@@ -21,7 +21,7 @@
plan(1)
- new $P0, ['AddrRegistry']
+ $P0 = new ['AddrRegistry']
ok(1, 'Instantiated .AddrRegistry')
.end
Modified: trunk/t/pmc/boolean.t
==============================================================================
--- trunk/t/pmc/boolean.t (original)
+++ trunk/t/pmc/boolean.t Wed Jan 7 17:56:10 2009
@@ -31,7 +31,7 @@
.end
.sub init_int_tests
- new $P0, 'Boolean'
+ $P0 = new ['Boolean']
set $I0, $P0
is($I0, 0, "Boolean defaults to false")
@@ -48,7 +48,7 @@
.sub num_tests
- new $P0, 'Boolean'
+ $P0 = new ['Boolean']
set $N0, 0
set $P0, $N0
set $I0, $P0
@@ -61,7 +61,7 @@
.end
.sub string_tests
- new $P0, 'Boolean'
+ $P0 = new ['Boolean']
set $S0, "0"
set $P0, $S0
@@ -80,8 +80,8 @@
.end
.sub pmc_to_pmc_tests
- new $P0, 'Boolean'
- new $P1, 'Boolean'
+ $P0 = new ['Boolean']
+ $P1 = new ['Boolean']
set $P0, 1
clone $P1, $P0
@@ -98,7 +98,7 @@
.end
.sub boolean_as_conditional
- new $P0, 'Boolean'
+ $P0 = new ['Boolean']
set $P0, 1
if $P0, OK_1
@@ -110,9 +110,9 @@
.end
.sub logic_operations
- new $P0, 'Boolean'
- new $P1, 'Boolean'
- new $P2, 'Boolean'
+ $P0 = new ['Boolean']
+ $P1 = new ['Boolean']
+ $P2 = new ['Boolean']
set $P0, 1
set $P1, 0
@@ -158,8 +158,8 @@
.end
.sub negation_tests
- new $P0, 'Boolean'
- new $P1, 'Boolean'
+ $P0 = new ['Boolean']
+ $P1 = new ['Boolean']
set $P0, 1
neg $P1, $P0
@@ -182,7 +182,7 @@
.local pmc p
.local int b
- p = new 'Boolean'
+ p = new ['Boolean']
does b, p, "scalar"
is(b, 1, "Boolean does scalar")
does b, p, "boolean"
Modified: trunk/t/pmc/bound_nci.t
==============================================================================
--- trunk/t/pmc/bound_nci.t (original)
+++ trunk/t/pmc/bound_nci.t Wed Jan 7 17:56:10 2009
@@ -21,7 +21,7 @@
plan(1)
- new $P0, 'Bound_NCI'
+ $P0 = new ['Bound_NCI']
ok(1, 'Instantiated .Bound_NCI')
.end
Modified: trunk/t/pmc/callsignature.t
==============================================================================
--- trunk/t/pmc/callsignature.t (original)
+++ trunk/t/pmc/callsignature.t Wed Jan 7 17:56:10 2009
@@ -27,7 +27,7 @@
.sub instantiate
- new $P0, 'CallSignature'
+ $P0 = new ['CallSignature']
ok(1, 'Instantiated CallSignature')
.end
Modified: trunk/t/pmc/capture.t
==============================================================================
--- trunk/t/pmc/capture.t (original)
+++ trunk/t/pmc/capture.t Wed Jan 7 17:56:10 2009
@@ -27,7 +27,7 @@
my $PRE = <<PRE;
.sub 'test' :main
.local pmc capt
- capt = new 'Capture'
+ capt = new ['Capture']
PRE
my $POST = <<POST;
@@ -47,33 +47,33 @@
pir_output_is( <<'CODE', <<'OUTPUT', "Basic capture tests" );
.sub main :main
.local pmc capt
- capt = new 'Capture'
+ capt = new ['Capture']
capt[0] = 0
capt[1] = 1.5
capt[2] = 'two'
- $P0 = new 'Integer'
+ $P0 = new ['Integer']
$P0 = 3
capt[3] = $P0
push capt, 4
push capt, 5.5
push capt, 'six'
- $P0 = new 'Integer'
+ $P0 = new ['Integer']
$P0 = 7
push capt, $P0
unshift capt, 8
unshift capt, 9.5
unshift capt, 'ten'
- $P0 = new 'Integer'
+ $P0 = new ['Integer']
$P0 = 11
unshift capt, $P0
capt['alpha'] = 12
capt['beta'] = 13.5
capt['gamma'] = 'fourteen'
- $P0 = new 'Integer'
+ $P0 = new ['Integer']
$P0 = 15
capt['delta'] = $P0
@@ -164,7 +164,7 @@
pir_output_is( <<'CODE', <<'OUTPUT', "defined, delete, exists" );
.sub main :main
.local pmc capt
- capt = new 'Capture'
+ capt = new ['Capture']
$I0 = defined capt[2]
$I1 = exists capt[2]
@@ -182,7 +182,7 @@
capt[2] = 1
capt['alpha'] = 1
- $P0 = new 'Undef'
+ $P0 = new ['Undef']
capt['beta'] = $P0
$I0 = defined capt[2]
@@ -272,14 +272,14 @@
pir_output_is( <<'CODE', <<'OUTPUT', '*_keyed_int delegation' );
.sub main :main
$P99 = subclass 'Capture', 'Match'
- $P1 = new 'Match'
+ $P1 = new ['Match']
$P1[1] = 1
$I1 = elements $P1
print $I1
print "\n"
$P99 = subclass 'Match', 'Exp'
- $P2 = new 'Exp'
+ $P2 = new ['Exp']
$P2[1] = 1
$I2 = elements $P2
print $I2
@@ -296,12 +296,12 @@
$P0 = subclass 'Capture', 'Match'
addattribute $P0, '$.abc'
addattribute $P0, '$.xyz'
- $P1 = new 'Match'
+ $P1 = new ['Match']
$P1[1] = 1
- $P2 = new 'String'
+ $P2 = new ['String']
setattribute $P1, '$.abc', $P2
- $P2 = new 'String'
+ $P2 = new ['String']
setattribute $P1, '$.xyz', $P2
$P2 = $P1.'list'()
Modified: trunk/t/pmc/class.t
==============================================================================
--- trunk/t/pmc/class.t (original)
+++ trunk/t/pmc/class.t Wed Jan 7 17:56:10 2009
@@ -24,7 +24,7 @@
load_bytecode 'Test/More.pir'
.local pmc exporter, test_ns
test_ns = get_namespace [ 'Test'; 'More' ]
- exporter = new 'Exporter'
+ exporter = new ['Exporter']
exporter.'import'( test_ns :named('source'), 'plan ok is isa_ok todo'
:named('globals') )
plan(TESTS)
@@ -52,9 +52,9 @@
.sub 'new op'
.local pmc class
.local int isa_class
- new class, 'Class'
+ class = new ['Class']
- ok(1, "$P0 = new 'Class'")
+ ok(1, "$P0 = new ['Class']")
isa_ok(class, 'Class')
.end
@@ -65,7 +65,7 @@
.local int class_flags, class_flag_set
.const int POBJ_IS_CLASS_FLAG = 536870912 # 1 << 29
- new class, 'Class'
+ class = new ['Class']
class_flags_pmc = inspect class, 'flags'
class_flags = class_flags_pmc
class_flag_set = class_flags & POBJ_IS_CLASS_FLAG
@@ -77,7 +77,7 @@
# L<PDD15/Class PMC API/=item name>
.sub 'name'
.local pmc class, result
- new class, 'Class'
+ class = new ['Class']
result = class.'name'()
is(result, '', 'name() with no args returns class name, which is empty at
first')
@@ -104,7 +104,7 @@
.sub 'new method'
.local pmc class, result, attrib
.local int isa_object
- new class, 'Class'
+ class = new ['Class']
result = class.'new'()
isa_ok(result, 'Object')
@@ -119,7 +119,7 @@
ok($I0, 'new() with non-attribute key fails')
$I0 = 1
- class = new 'Class'
+ class = new ['Class']
class.'add_attribute'('foo')
class.'add_attribute'('bar')
result = class.'new'('foo' => 1, 'bar' => 2)
@@ -139,7 +139,7 @@
.sub 'attributes'
.local pmc class, attribs
.local int test_val
- new class, 'Class'
+ class = new ['Class']
attribs = class.'attributes'()
test_val = isa attribs, 'Hash'
@@ -163,7 +163,7 @@
.sub 'add_attribute'
.local pmc class, attribs
.local int test_val
- new class, 'Class'
+ class = new ['Class']
$I0 = 1
push_eh t_no_args
@@ -198,7 +198,7 @@
# L<PDD15/Class PMC API>
.sub 'set_attr/get_attr'
.local pmc class, class_instance, attrib_in, attrib_out
- new class, 'Class'
+ class = new ['Class']
class.'name'("Test")
class.'add_attribute'("foo")
ok(1, 'created a class with one attribute')
@@ -206,7 +206,7 @@
class_instance = class.'new'()
ok(1, 'instantiated the class')
- attrib_in = new 'Integer'
+ attrib_in = new ['Integer']
attrib_in = 42
setattribute class_instance, "foo", attrib_in
ok(1, 'set an attribute')
@@ -220,7 +220,7 @@
.sub 'add_method' # todo => 'not yet implemented'
.local pmc class, attribs, meth_to_add, test_attr_val
.local int test_val
- new class, 'Class'
+ class = new ['Class']
$I0 = 1
push_eh t_no_args
@@ -285,7 +285,7 @@
.sub 'parents'
.local pmc class, parents
.local int isa_parent
- new class, 'Class'
+ class = new ['Class']
parents = class.'parents'()
## XXX is this really what's expected?
@@ -305,7 +305,7 @@
.sub 'roles'
.local pmc class, array
.local int is_array
- new class, 'Class'
+ class = new ['Class']
array = class.'roles'()
## XXX is this really what's expected?
@@ -324,7 +324,7 @@
.local pmc class, result
.local int test_val
- class = new 'Class'
+ class = new ['Class']
class.'name'('foo')
class.'add_attribute'('a')
@@ -349,9 +349,9 @@
.local string test_name
.local int test_val
- attrs = new 'Hash'
+ attrs = new ['Hash']
attrs['name'] = 'Monkey'
- class = new 'Class', attrs
+ class = new ['Class'], attrs
class.'add_attribute'('banana')
class_instance = class.'new'()
ok(1, 'clone() created class Monkey and instantiated it')
@@ -380,14 +380,14 @@
.local string test_string_val
.local int num_elems
- class = new 'Hash'
+ class = new ['Hash']
class['name'] = 'Monkey2'
- class_instance = new 'Class', class
+ class_instance = new ['Class'], class
class_instance.'add_attribute'('banana')
monkey = class_instance.'new'()
ok(1, 'clone_pmc() created class Monkey and instantiated it')
- class = new 'Hash'
+ class = new ['Hash']
class['name'] = 'Mandrill'
mandrill = clone class_instance, class
ok(1, 'clone_pmc() cloned class Monkey with Hash argument')
@@ -411,31 +411,31 @@
.sub 'new with init hash'
.local pmc class, init_hash, attrs, methods, meth_to_add, class_instance
.local pmc attr_val, result
- init_hash = new 'Hash'
+ init_hash = new ['Hash']
# We'll have some attributes...
- attrs = new 'ResizablePMCArray'
+ attrs = new ['ResizablePMCArray']
attrs[0] = 'x'
attrs[1] = 'y'
init_hash['attributes'] = attrs
# And a method.
- methods = new 'Hash'
+ methods = new ['Hash']
meth_to_add = get_global 'add'
methods['add'] = meth_to_add
init_hash['methods'] = methods
- class = new 'Class', init_hash
+ class = new ['Class'], init_hash
ok(1, 'new() created new class with attributes and methods supplied')
# Instantiate and try setting each attribute.
class_instance = class.'new'()
- attr_val = new 'Integer'
+ attr_val = new ['Integer']
attr_val = 37
setattribute class_instance, 'x', attr_val
ok(1, 'new() set first attribute')
- attr_val = new 'Integer'
+ attr_val = new ['Integer']
attr_val = 5
setattribute class_instance, 'y', attr_val
ok(1, 'new() set second attribute')
@@ -448,7 +448,7 @@
.sub add :method
$P0 = getattribute self, "x"
$P1 = getattribute self, "y"
- $P2 = new 'Integer'
+ $P2 = new ['Integer']
$P2 = $P0 + $P1
.return($P2)
.end
@@ -457,7 +457,7 @@
# L<PDD15/Class PMC API/=item isa>
.sub 'isa'
.local pmc class
- new class, 'Class'
+ class = new ['Class']
test_isa( class, 'Class', 1 )
test_isa( class, 'Hash', 0 )
@@ -495,22 +495,22 @@
.sub 'does'
.local pmc class
.local pmc attrs
- attrs = new 'Hash'
+ attrs = new ['Hash']
.local pmc red, green, blue
attrs['name'] = 'Red'
- red = new 'Role', attrs
+ red = new ['Role'], attrs
attrs['name'] = 'Green'
- green = new 'Role', attrs
+ green = new ['Role'], attrs
attrs['name'] = 'Blue'
- blue = new 'Role', attrs
+ blue = new ['Role'], attrs
green.'add_role'( blue )
.local pmc color
- color = new 'Class'
+ color = new ['Class']
test_does( color, 'Red', 0 )
@@ -554,22 +554,22 @@
# L<PDD15/Class PMC API/=item does>
.sub 'more does' # RT #42974
.local pmc attrs
- attrs = new 'Hash'
+ attrs = new ['Hash']
.local pmc red, green, blue
attrs['name'] = 'Red'
- red = new 'Role', attrs
+ red = new ['Role'], attrs
attrs['name'] = 'Green'
- green = new 'Role', attrs
+ green = new ['Role'], attrs
attrs['name'] = 'Blue'
- blue = new 'Role', attrs
+ blue = new ['Role'], attrs
green.'add_role'( blue )
.local pmc color
- color = new 'Class'
+ color = new ['Class']
$S0 = 'Red'
$I0 = color.'does'($S0)
Modified: trunk/t/pmc/closure.t
==============================================================================
--- trunk/t/pmc/closure.t (original)
+++ trunk/t/pmc/closure.t Wed Jan 7 17:56:10 2009
@@ -18,7 +18,7 @@
=cut
.sub main :main
- .include 'include/test_more.pir'
+ .include 'test_more.pir'
plan(3)
@@ -27,7 +27,7 @@
.end
.sub new_closure
- new $P0, 'Closure'
+ $P0 = new ['Closure']
ok( 1, 'Created new Closure' )
isa_ok( $P0, 'Closure' )
.end
@@ -37,7 +37,7 @@
## sub->outer_ctx to be initialized, regardless of whether the closure
## had ever been called.
.lex "X", $P40
- $P40 = new 'Integer'
+ $P40 = new ['Integer']
$P40 = 22
.const 'Sub' $P43 = "___internal_test_1_0_"
newclosure $P44, $P43
Modified: trunk/t/pmc/codestring.t
==============================================================================
--- trunk/t/pmc/codestring.t (original)
+++ trunk/t/pmc/codestring.t Wed Jan 7 17:56:10 2009
@@ -36,7 +36,7 @@
.sub create_codestring
.local pmc code
.local string s
- code = new 'CodeString'
+ code = new ['CodeString']
code = 'ok'
s = code
is(s, "ok", "code string creation succeeded")
@@ -45,7 +45,7 @@
.sub calls_to_unique
.local pmc code
.local string s
- code = new 'CodeString'
+ code = new ['CodeString']
$P1 = code.'unique'('ok ')
s = $P1
is(s, "ok 10", "call to unique with name")
@@ -59,7 +59,7 @@
.sub basic_emit
.local pmc code
- code = new 'CodeString'
+ code = new ['CodeString']
code.'emit'('label:')
code.'emit'(' say "Hello, World"')
code.'emit'(' $I0 = 1')
@@ -74,7 +74,7 @@
.sub emit_with_pos_args
.local pmc code
- code = new 'CodeString'
+ code = new ['CodeString']
code.'emit'('label_%0:', 1234)
code.'emit'(' say "%0, %1"', 'Hello', 'World')
code.'emit'(' %0 = %2', '$I0', 24, 48)
@@ -87,7 +87,7 @@
.sub emit_with_percent_args
.local pmc code
- code = new 'CodeString'
+ code = new ['CodeString']
code.'emit'('label_%0:', 1234)
code.'emit'(' say "%,"', 'Hello')
code.'emit'(' say "%,"', 'Hello', 'World', 'of', 'Parrot')
@@ -100,7 +100,7 @@
.sub emit_with_named_args
.local pmc code
- code = new 'CodeString'
+ code = new ['CodeString']
code.'emit'('label_%a:', 'a'=>1234)
code.'emit'(' say "%b, %c"', 'b'=>'Hello', 'c'=>'World')
code.'emit'(' say "%d"', 'b'=>'Hello', 'c'=>'World')
@@ -113,7 +113,7 @@
.sub emit_with_pos_and_named_args
.local pmc code
- code = new 'CodeString'
+ code = new ['CodeString']
code.'emit'('label_%a:', 'a'=>1234)
code.'emit'(' %0 "%b, %c"', 'say', 'print', 'b'=>'H', 'c'=>'W')
code.'emit'(' say "%,, %c"', 'alpha', 'beta', 'b'=>'H', 'c'=>'W')
@@ -126,8 +126,8 @@
.sub output_global_unique_num
.local pmc code1, code2
- code1 = new 'CodeString'
- code2 = new 'CodeString'
+ code1 = new ['CodeString']
+ code2 = new ['CodeString']
.local string unique1, unique2
unique1 = code1.'unique'()
unique2 = code2.'unique'('$P')
@@ -137,7 +137,7 @@
.sub namespace_keys
.local pmc code
- code = new 'CodeString'
+ code = new ['CodeString']
$S0 = code.'key'('abc')
is($S0, '["abc"]', "unnested namespace key ok")
$S0 = code.'key'('abc', 'def')
@@ -154,7 +154,7 @@
.sub first_char_repl_regression
.local pmc code
null $P0
- code = new 'CodeString'
+ code = new ['CodeString']
code.'emit'('new', 'n'=>$P0)
is(code, "new\n", "regression on first char repl bug looks fine")
.end
Modified: trunk/t/pmc/complex.t
==============================================================================
--- trunk/t/pmc/complex.t (original)
+++ trunk/t/pmc/complex.t Wed Jan 7 17:56:10 2009
@@ -105,8 +105,8 @@
.endm
.sub string_parsing
- new $P0, 'Complex'
- new $P1, 'String'
+ $P0 = new ['Complex']
+ $P1 = new ['String']
set $P0, "4"
is( $P0, "4+0i", '"4" parsed as 4+0i' )
@@ -161,7 +161,7 @@
.end
.sub exception_malformed_string__real_part
- new $P0, 'Complex'
+ $P0 = new ['Complex']
push_eh handler
set $P0, "q + 3i"
pop_eh
@@ -170,7 +170,7 @@
.end
.sub exception_malformed_string__imaginary_part
- new $P0, 'Complex'
+ $P0 = new ['Complex']
push_eh handler
set $P0, "1 + ij"
pop_eh
@@ -179,7 +179,7 @@
.end
.sub exception_malformed_string__missing_plus_or_minus
- new $P0, 'Complex'
+ $P0 = new ['Complex']
push_eh handler
set $P0, "1 * i"
pop_eh
@@ -188,10 +188,10 @@
.end
.sub test_complex_add
- new $P0, 'Complex'
- new $P1, 'Complex'
- new $P2, 'Float'
- new $P3, 'Integer'
+ $P0 = new ['Complex']
+ $P1 = new ['Complex']
+ $P2 = new ['Float']
+ $P3 = new ['Integer']
set $P0, "1 + i"
add $P0, $P0, $P0
@@ -231,10 +231,10 @@
.end
.sub test_complex_subtract
- new $P0, 'Complex'
- new $P1, 'Complex'
- new $P2, 'Float'
- new $P3, 'Integer'
+ $P0 = new ['Complex']
+ $P1 = new ['Complex']
+ $P2 = new ['Float']
+ $P3 = new ['Integer']
set $P0, "1 + i"
sub $P0, $P0, $P0
@@ -274,10 +274,10 @@
.end
.sub test_complex_multiply
- new $P0, 'Complex'
- new $P1, 'Complex'
- new $P2, 'Float'
- new $P3, 'Integer'
+ $P0 = new ['Complex']
+ $P1 = new ['Complex']
+ $P2 = new ['Float']
+ $P3 = new ['Integer']
set $P0, "2 + 3i"
mul $P0, $P0, $P0
@@ -318,9 +318,9 @@
.end
.sub test_complex_divide
- new $P0, 'Complex'
- new $P1, 'Complex'
- new $P2, 'Float'
+ $P0 = new ['Complex']
+ $P1 = new ['Complex']
+ $P2 = new ['Float']
set $P0, "2 + 3i"
div $P0, $P0, $P0
@@ -356,11 +356,11 @@
skip( 1, 'div by zero not caught' )
.return()
- $P0 = new 'Complex'
+ $P0 = new ['Complex']
set $P0, "4+3.5i"
- $P1 = new 'Complex'
+ $P1 = new ['Complex']
## divide by a zero Complex
- $P2 = new 'Complex'
+ $P2 = new ['Complex']
set $P2, 0
push_eh handler
$P1 = $P0 / $P2
@@ -373,11 +373,11 @@
skip( 1, 'div by zero not caught' )
.return()
- $P0 = new 'Complex'
+ $P0 = new ['Complex']
set $P0, "4+3.5i"
- $P1 = new 'Complex'
+ $P1 = new ['Complex']
## divide by a zero Float
- $P2 = new 'Float'
+ $P2 = new ['Float']
set $P2, 0
push_eh handler
$P1 = $P0 / $P2
@@ -389,11 +389,11 @@
skip( 1, 'div by zero not caught' )
.return()
- $P0 = new 'Complex'
+ $P0 = new ['Complex']
set $P0, "4+3.5i"
- $P1 = new 'Complex'
+ $P1 = new ['Complex']
## divide by a zero Integer
- $P2 = new 'Integer'
+ $P2 = new ['Integer']
set $P2, 0
push_eh handler
$P1 = $P0 / $P2
@@ -402,7 +402,7 @@
.end
.sub get_int_or_num_or_bool
- new $P0, 'Complex'
+ $P0 = new ['Complex']
set $P0, "2 - 1.5i"
is( $P0, "2-1.5i", 'Complex "2 - 1.5i" returned ok' )
@@ -419,8 +419,8 @@
.end
.sub test_get_keyed
- new $P0, 'Complex'
- new $P1, 'String'
+ $P0 = new ['Complex']
+ $P1 = new ['String']
set $P0, "- 3.3 + 1.2i"
set $P1, "imag"
@@ -443,7 +443,7 @@
.end
.sub exception_get_keyed__invalid_string_key
- new $P0, 'Complex'
+ $P0 = new ['Complex']
set $P0, "5 + 3.5i"
push_eh handler
set $N0, $P0["Foo55"]
@@ -452,7 +452,7 @@
.end
.sub exception_get_keyed__invalid_numeric_key
- new $P0, 'Complex'
+ $P0 = new ['Complex']
set $P0, "5 + 3.5i"
push_eh handler
set $N0, $P0[2]
@@ -461,7 +461,7 @@
.end
.sub set_int_or_num
- new $P0, 'Complex'
+ $P0 = new ['Complex']
set $P0, "3 + 4i"
set $P0, -2
@@ -473,9 +473,9 @@
.end
.sub set_keyed
- new $P0, 'Complex'
- new $P1, 'String'
- new $P2, 'String'
+ $P0 = new ['Complex']
+ $P1 = new ['String']
+ $P2 = new ['String']
set $P1, "real"
set $P0[$P1], 1
@@ -494,7 +494,7 @@
.end
.sub exception_set_keyed__invalid_key
- new $P0, 'Complex'
+ $P0 = new ['Complex']
push_eh handler
set $P0[2], 12.5
handler:
@@ -502,8 +502,8 @@
.end
.sub test_is_equal
- new $P0, 'Complex'
- new $P1, 'Complex'
+ $P0 = new ['Complex']
+ $P1 = new ['Complex']
set $P0, "2 + 3j"
set $P1["real"], 2
@@ -515,16 +515,16 @@
.end
.sub test_complex_abs
- new $P0, 'Complex'
+ $P0 = new ['Complex']
set $P0, "4 + 3i"
- new $P1, 'Undef'
+ $P1 = new ['Undef']
abs $P1, $P0
is( $P1, "5", 'abs 4+3j -> 5' )
.end
.sub check_whether_interface_is_done
.local pmc pmc1
- pmc1 = new 'Complex'
+ pmc1 = new ['Complex']
.local int bool1
does bool1, pmc1, "scalar"
@@ -564,9 +564,9 @@
.return()
$P0 = get_class "Complex"
- $P1 = new 'Float'
+ $P1 = new ['Float']
$P1 = 2.0
- $P2 = new 'Float'
+ $P2 = new ['Float']
$P2 = 3.0
# $P1 = $P0."instantiate"($P1, $P2)
is( $P1, "2+3i", 'instantiate pir p' )
@@ -582,9 +582,9 @@
.end
.sub test_complex_neg
- new $P0, 'Complex'
+ $P0 = new ['Complex']
set $P0, "1.3 + 1.7i"
- new $P1, 'Integer'
+ $P1 = new ['Integer']
neg $P1, $P0
set $N0, $P1[0]
set $N1, $P1[1]
@@ -593,7 +593,7 @@
.end
.sub test_clone
- new $P0, 'Complex'
+ $P0 = new ['Complex']
set $P0, "1 - 3i"
clone $P1, $P0
is( $P0, $P1, 'clone Complex PMC')
@@ -607,9 +607,9 @@
.sub test_sub
.local pmc d, f, c
- d = new 'Undef'
- f = new 'Float'
- c = new 'Complex'
+ d = new ['Undef']
+ f = new ['Float']
+ c = new ['Complex']
f = 2.2
c = "5+2j"
d = c - f
@@ -627,13 +627,13 @@
.sub test_i_sub
.local pmc f, c
- f = new 'Float'
+ f = new ['Float']
f = 2.2
- c = new 'Complex'
+ c = new ['Complex']
c = "5+2j"
c -= f
is( c, '2.8+2i', 'Complex -= test' )
- c = new 'Complex'
+ c = new ['Complex']
c = "5+2j"
f -= c
is( f, '-2.8-2i', '... and reverse it' )
@@ -648,7 +648,7 @@
.sub sprintf_with_a_complex
.local pmc c, c2
- c = new 'Complex'
+ c = new ['Complex']
.sprintf_is( "%d%+di", "1.35+35.1i", "1+35i" )
.sprintf_is( "%.3f%+.3fi", "0+3.141592653589793i", "0.000+3.142i" )
.sprintf_is( "%.3f%+.3fi", "0+i", "0.000+1.000i" )
@@ -665,27 +665,27 @@
.sub pow_with_complex_numbers
.local pmc c, c2, c3
- c = new 'Complex'
- c2 = new 'Complex'
- c3 = new 'Complex'
+ c = new ['Complex']
+ c2 = new ['Complex']
+ c3 = new ['Complex']
.pow_test_is( "i", "i", "0.207880+0.000000i" )
.pow_test_is( "i", "2", "-1.000000+0.000000i" )
.pow_test_is( "2i", "2", "-4.000000+0.000000i" )
.pow_test_is( "2+2i", "2+2i", "-1.452505-0.809890i" )
.pow_test_is( "i", "0.5i", "0.455938+0.000000i" )
.pow_test_is( 2, "2i", "0.183457+0.983028i" )
- c2 = new 'Integer'
+ c2 = new ['Integer']
.pow_test_is( "2i", 2, "-4.000000+0.000000i" )
.pow_test_is( "2", 4, "16.000000+0.000000i" )
- c2 = new 'Float'
+ c2 = new ['Float']
.pow_test_is( "2i", 0.5, "1.000000+1.000000i" )
.end
.sub e_raised_pi_time_i__plus_1_equal_0
.local pmc c, c2, c3
- c = new 'Complex'
- c2 = new 'Complex'
- c3 = new 'Complex'
+ c = new ['Complex']
+ c2 = new ['Complex']
+ c3 = new ['Complex']
# e^(pi * i) + 1 = 0
$N0 = atan 1
$N0 *= 4
@@ -700,8 +700,8 @@
# # Need to find some formal spec for when to return -0.0.
.macro complex_op_is( val, res, op )
- new $P1, 'Complex'
- new $P2, 'Complex'
+ $P1 = new ['Complex']
+ $P2 = new ['Complex']
set $P1, .val
set $S0, .val
@@ -1167,13 +1167,13 @@
.local pmc a, b, c
## a = 1 + 2i
- a = new 'MyComplex'
+ a = new ['MyComplex']
a['real'] = 1
a['imag'] = 2
is( a, "1+2i", '' )
## b = 3 + 4i
- b = new 'MyComplex'
+ b = new ['MyComplex']
b['real'] = 3
b['imag'] = 4
is( b, "3+4i" , '' )
@@ -1186,9 +1186,9 @@
.namespace ['MyComplex']
.sub 'init' :vtable
- $P1 = new 'Float'
+ $P1 = new ['Float']
setattribute self, "re", $P1
- $P2 = new 'Float'
+ $P2 = new ['Float']
setattribute self, "im", $P2
.end