2 # Copyright (C) 2001-2006, Parrot Foundation.
7 use lib qw( . lib ../lib ../../lib );
9 use Parrot::Test tests => 23;
13 t/pmc/orderedhash.t - Ordered Hash
17 % prove t/pmc/orderedhash.t
21 Tests the C<OrderedHash> PMC.
25 pasm_output_is( <<'CODE', <<OUT, "init" );
26 new P0, ['OrderedHash']
38 pasm_output_is( <<'CODE', <<OUT, "set keys, get idx" );
39 new P0, ['OrderedHash']
79 pasm_output_is( <<'CODE', <<OUT, "iterate" );
80 .include "iterator.pasm"
81 new P0, ['OrderedHash']
93 set P2, .ITERATE_FROM_START
102 set P2, .ITERATE_FROM_END
120 pasm_output_is( <<'CODE', <<OUT, "idx only" );
121 new P0, ['OrderedHash']
139 pasm_output_is( <<'CODE', <<OUT, "set keys, get idx - cloned" );
140 new P10, ['OrderedHash']
193 pasm_output_is( <<'CODE', <<OUT, "exists_keyed" );
194 new P0, ['OrderedHash']
201 exists I0, P0["nokey"]
218 pasm_output_is( <<'CODE', <<OUT, "defined_keyed" );
219 new P0, ['OrderedHash']
222 defined I0, P0["key"]
226 defined I0, P0["nokey"]
239 defined I0, P0["key"]
256 pasm_output_is( <<'CODE', <<OUT, "delete" );
257 .include "iterator.pasm"
258 new P0, ['OrderedHash']
272 set P2, .ITERATE_FROM_START_KEYS
283 set P2, .ITERATE_FROM_START_KEYS
299 pasm_output_is( <<'CODE', <<'OUTPUT', "delete with int keys" );
300 new P0, ['OrderedHash']
319 pasm_output_like( <<'CODE', '/[axj]/', "iterate over keys" );
320 .include "iterator.pasm"
321 new P0, ['OrderedHash']
333 set P2, .ITERATE_FROM_START_KEYS
343 pasm_output_like( <<'CODE', <<'OUT', "iterate over keys, get value" );
344 .include "iterator.pasm"
345 new P0, ['OrderedHash']
357 set P2, .ITERATE_FROM_START_KEYS
372 pir_output_is( << 'CODE', << 'OUTPUT', "OrderedHash in PIR with PMC value" );
376 hash1 = new ['OrderedHash']
378 val_in = new ['String']
393 pir_output_is( << 'CODE', << 'OUTPUT', "OrderedHash set_integer_keyed" );
397 hash1 = new ['OrderedHash']
411 pir_output_is( << 'CODE', << 'OUTPUT', "OrderedHash set_string_keyed" );
415 hash1 = new ['OrderedHash']
431 pir_output_is( << 'CODE', << 'OUTPUT', "OrderedHash set_string_keyed" );
435 hash1 = new ['OrderedHash']
449 # actually Parrot_OrderedHash_set_string_keyed is used, why ?
450 pir_output_is( << 'CODE', << 'OUTPUT', "OrderedHash set_string_keyed_str" );
454 hash1 = new ['OrderedHash']
461 val_out = hash1[key1]
471 pir_output_is( << 'CODE', << 'OUTPUT', "OrderedHash set_number_keyed" );
475 hash1 = new ['OrderedHash']
482 val_out = hash1[key1]
492 pir_output_is( << 'CODE', << 'OUTPUT', "OrderedHash get_integer" );
496 hash1 = new ['OrderedHash']
513 hash1['size'] = hash_size
527 pasm_output_is( <<'CODE', <<'OUTPUT', "delete and access remaining" );
528 new P0, ['OrderedHash']
552 pir_output_is( << 'CODE', << 'OUTPUT', "check whether interface is done" );
556 pmc1 = new ['OrderedHash']
558 does bool1, pmc1, "scalar"
561 does bool1, pmc1, "hash"
564 does bool1, pmc1, "array"
567 does bool1, pmc1, "no_interface"
579 pasm_output_is( <<'CODE', <<'OUTPUT', "get_integer_keyed" );
580 new P0, ['OrderedHash']
603 pasm_output_is( <<'CODE', <<'OUTPUT', "get_number_keyed" );
604 new P0, ['OrderedHash']
633 pasm_output_is( <<'CODE', <<'OUTPUT', "freeze/thaw 1" );
634 new P0, ['OrderedHash']
659 # cperl-indent-level: 4
662 # vim: expandtab shiftwidth=4: