2 # Copyright (C) 2001-2010, Parrot Foundation.
7 t/pmc/orderedhashiterator.t - Ordered Hash Iterator
11 % prove t/pmc/orderedhashiterator.t
15 Do almost nothing test. Main purpose of OrderedHashIterator covered by
20 .include 'iterator.pasm'
21 .include 'except_types.pasm'
24 .include 'test_more.pir'
38 # We can't create OrderedHashIterator directly
41 oh = new ['OrderedHashIterator']
45 ok(i, "Can't create OrderedHashIterator directly")
47 oh = new ['OrderedHash']
49 sweep 1 # Make sure the mark vtable is covered
50 i = isa it, 'Iterator'
51 i2 = isa it, 'OrderedHashIterator'
53 is(i, 2, 'OrderedHashIterator has proper type')
55 # elements and get_integer should both return 0
59 is(i, 0, 'iterator for empty OrderedHash has size 0')
65 oh = new ['OrderedHash']
68 eh = new ['ExceptionHandler']
69 eh.'handle_types'(.EXCEPTION_INVALID_OPERATION)
72 it = 9999 # Let's hope it will never be a valid iteration type
77 ok(i, 'invalid iteration type throws')
81 .local pmc oh, it, eh, p
83 oh = new ['OrderedHash']
86 eh = new ['ExceptionHandler']
87 eh.'handle_types'(.EXCEPTION_OUT_OF_BOUNDS)
95 ok(i, 'shift_pmc in empty OH throws')
99 .local pmc oh, it, eh, p
101 oh = new ['OrderedHash']
103 it = .ITERATE_FROM_END
105 eh = new ['ExceptionHandler']
106 eh.'handle_types'(.EXCEPTION_OUT_OF_BOUNDS)
114 ok(i, 'pop_pmc in empty OH throws')
118 .local pmc oh, it, cl
120 oh = new ['OrderedHash']
123 # This chekcs the de facto behavior for code coverage purposes.
126 ok(result, 'clone of OHI gives null')
133 # vim: expandtab shiftwidth=4 ft=pir: