# Array Specs

**URL:** <https://www.ruby-forum.com/t/array-specs/215452>\
**Category:** IronRuby\
**Created:** [January 4, 2012, 10:57pm UTC](https://www.ruby-forum.com/t/array-specs/215452 "2012-01-04T22:57:25Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![dubstep](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/cdc98d/32.png) [@dubstep](https://www.ruby-forum.com/u/dubstep)\
**Post date:** [January 4, 2012, 10:57pm UTC](https://www.ruby-forum.com/t/array-specs/215452/1 "2012-01-04T22:57:25Z")

</div>

I’ve been working on bringing IronRuby up to speed with rubyspec, and  
picked the core\array folder as a start:

My pull request is here:

> <https://github.com/IronLanguages/main/pull/52>
>
> Update IronRuby to pass more of rubyspec core/array specs

## I’d like to fix them all, but I’m not sure if I’ll have the time to do so

## Here is a summary of the rubyspec\core\array folder as of right now:

ok means the spec was already passing  
fixed means the spec was failing, and I have fixed it  
FAILS means the specs fail, and I have not fixed them yet

ok allocate\_spec.rb  
ok append\_spec.rb  
ok array\_spec.rb  
ok assoc\_spec.rb  
ok at\_spec.rb  
ok choice\_spec.rb  
ok clear\_spec.rb  
ok clone\_spec.rb  
ok collect\_spec.rb  
ok combination\_spec.rb  
ok compact\_spec.rb  
ok comparison\_spec.rb  
ok concat\_spec.rb  
ok constructor\_spec.rb  
ok count\_spec.rb  
ok cycle\_spec.rb  
ok delete\_at\_spec.rb  
ok delete\_if\_spec.rb  
ok delete\_spec.rb  
ok drop\_spec.rb  
ok drop\_while\_spec.rb  
ok dup\_spec.rb  
ok each\_index\_spec.rb  
ok each\_spec.rb  
ok element\_reference\_spec.rb  
fixed element\_set\_spec.rb  
ok empty\_spec.rb  
ok eql\_spec.rb  
ok equal\_value\_spec.rb  
ok fetch\_spec.rb  
fixed fill\_spec.rb  
ok find\_index\_spec.rb  
ok first\_spec.rb  
FAILS flatten\_spec.rb  
ok frozen\_spec.rb  
FAILS hash\_spec.rb  
ok include\_spec.rb  
ok indexes\_spec.rb  
ok index\_spec.rb  
ok indices\_spec.rb  
ok initialize\_copy\_spec.rb  
ok initialize\_spec.rb  
ok insert\_spec.rb  
FAILS inspect\_spec.rb  
ok intersection\_spec.rb  
FAILS join\_spec.rb  
FAILS keep\_if\_spec.rb  
ok last\_spec.rb  
ok length\_spec.rb  
ok map\_spec.rb  
ok minus\_spec.rb  
FAILS multiply\_spec.rb  
ok new\_spec.rb  
ok nitems\_spec.rb  
FAILS in MRI also pack\_spec.rb  
ok partition\_spec.rb  
ok permutation\_spec.rb  
ok plus\_spec.rb  
FAILS pop\_spec.rb  
!! HANGS product\_spec.rb  
ok push\_spec.rb  
ok rassoc\_spec.rb  
ok reject\_spec.rb  
FAILS repeated\_combination\_spec.rb  
FAILS repeated\_permutation\_spec.rb  
ok replace\_spec.rb  
ok reverse\_each\_spec.rb  
ok reverse\_spec.rb  
FAILS rindex\_spec.rb  
FAILS rotate\_spec.rb  
fixed sample\_spec.rb  
fixed select\_spec.rb  
fixed shift\_spec.rb  
fixed shuffle\_spec.rb  
ok size\_spec.rb  
FAILS slice\_spec.rb  
FAILS hard to fix sort\_by\_spec.rb  
FAILS hard to fix sort\_spec.rb  
ok take\_spec.rb  
ok take\_while\_spec.rb  
ok to\_ary\_spec.rb  
ok to\_a\_spec.rb  
ok to\_s\_spec.rb  
ok transpose\_spec.rb  
ok try\_convert\_spec.rb  
ok union\_spec.rb  
fixed uniq\_spec.rb  
ok unshift\_spec.rb  
ok values\_at\_spec.rb  
fixed zip\_spec.rb

---

<div class="post-metadata">

**Author:** ![Orion\_E](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/65b543/32.png) [@Orion\_E](https://www.ruby-forum.com/u/Orion_E)\
**Post date:** [January 5, 2012, 5:59am UTC](https://www.ruby-forum.com/t/array-specs/215452/2 "2012-01-05T05:59:54Z")

</div>

Cool! I’ll take a look asap.

Tomas

From: [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
[[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)] On Behalf Of Orion E.  
Sent: Wednesday, January 04, 2012 1:54 PM  
To: [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
Subject: [Ironruby-core] Array Specs

I’ve been working on bringing IronRuby up to speed with rubyspec, and  
picked the core\array folder as a start:

My pull request is here:

> <https://github.com/IronLanguages/main/pull/52>
>
> Update IronRuby to pass more of rubyspec core/array specs

I’d like to fix them all, but I’m not sure if I’ll have the time to do  
so -

## Here is a summary of the rubyspec\core\array folder as of right now:

ok means the spec was already passing  
fixed means the spec was failing, and I have fixed it  
FAILS means the specs fail, and I have not fixed them yet

ok allocate\_spec.rb  
ok append\_spec.rb  
ok array\_spec.rb  
ok assoc\_spec.rb  
ok at\_spec.rb  
ok choice\_spec.rb  
ok clear\_spec.rb  
ok clone\_spec.rb  
ok collect\_spec.rb  
ok combination\_spec.rb  
ok compact\_spec.rb  
ok comparison\_spec.rb  
ok concat\_spec.rb  
ok constructor\_spec.rb  
ok count\_spec.rb  
ok cycle\_spec.rb  
ok delete\_at\_spec.rb  
ok delete\_if\_spec.rb  
ok delete\_spec.rb  
ok drop\_spec.rb  
ok drop\_while\_spec.rb  
ok dup\_spec.rb  
ok each\_index\_spec.rb  
ok each\_spec.rb  
ok element\_reference\_spec.rb  
fixed element\_set\_spec.rb  
ok empty\_spec.rb  
ok eql\_spec.rb  
ok equal\_value\_spec.rb  
ok fetch\_spec.rb  
fixed fill\_spec.rb  
ok find\_index\_spec.rb  
ok first\_spec.rb  
FAILS flatten\_spec.rb  
ok frozen\_spec.rb  
FAILS hash\_spec.rb  
ok include\_spec.rb  
ok indexes\_spec.rb  
ok index\_spec.rb  
ok indices\_spec.rb  
ok initialize\_copy\_spec.rb  
ok initialize\_spec.rb  
ok insert\_spec.rb  
FAILS inspect\_spec.rb  
ok intersection\_spec.rb  
FAILS join\_spec.rb  
FAILS keep\_if\_spec.rb  
ok last\_spec.rb  
ok length\_spec.rb  
ok map\_spec.rb  
ok minus\_spec.rb  
FAILS multiply\_spec.rb  
ok new\_spec.rb  
ok nitems\_spec.rb  
FAILS in MRI also pack\_spec.rb  
ok partition\_spec.rb  
ok permutation\_spec.rb  
ok plus\_spec.rb  
FAILS pop\_spec.rb  
!! HANGS product\_spec.rb  
ok push\_spec.rb  
ok rassoc\_spec.rb  
ok reject\_spec.rb  
FAILS repeated\_combination\_spec.rb  
FAILS repeated\_permutation\_spec.rb  
ok replace\_spec.rb  
ok reverse\_each\_spec.rb  
ok reverse\_spec.rb  
FAILS rindex\_spec.rb  
FAILS rotate\_spec.rb  
fixed sample\_spec.rb  
fixed select\_spec.rb  
fixed shift\_spec.rb  
fixed shuffle\_spec.rb  
ok size\_spec.rb  
FAILS slice\_spec.rb  
FAILS hard to fix sort\_by\_spec.rb  
FAILS hard to fix sort\_spec.rb  
ok take\_spec.rb  
ok take\_while\_spec.rb  
ok to\_ary\_spec.rb  
ok to\_a\_spec.rb  
ok to\_s\_spec.rb  
ok transpose\_spec.rb  
ok try\_convert\_spec.rb  
ok union\_spec.rb  
fixed uniq\_spec.rb  
ok unshift\_spec.rb  
ok values\_at\_spec.rb  
fixed zip\_spec.rb

---

<div class="post-metadata">

**Author:** ![Orion\_E](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/65b543/32.png) [@Orion\_E](https://www.ruby-forum.com/u/Orion_E)\
**Post date:** [January 5, 2012, 11:05pm UTC](https://www.ruby-forum.com/t/array-specs/215452/3 "2012-01-05T23:05:56Z")

</div>

I’ve pushed some more changes to that branch:

fixed pop\_spec.rb  
fixed rindex\_spec.rb  
fixed rotate\_spec.rb  
fixed flatten\_spec.rb

I also had a look at a couple of others but didn’t fix them:

hash\_spec.rb  
This requires changing implementation of RubyArray#GetHashCode which I  
wasn’t confident enough to do  
In ruby, a recursive array equals itself, and therefore the hashcodes  
should match. IronRuby’s implementation of hash doesn’t support this.  
Furthermore, the following code should pass, which seemed quite a bit  
harder:

a = [1]  
a \<\< a  
[1,a] == a # both MRI and IR report true for this  
[1,a].hash == a.hash # Because objects are equal, hash should be too.  
MRI  
supports this, IR does not.

product\_spec.rb  
This was causing the tests to hang/crash because IR wasn’t sanity  
checking  
lengths. Rubyspec has a test which tries to create a stupdendously large  
product array, and so IR would run out of memory.  
I added range checking so the tests no longer hang/crash, but there is  
some additional behaviour (you can pass a block to Array#product in 1.9)  
that I haven’t implemented.

Here’s the output for mspec of the array folder:

IR

Finished in 18.282046 seconds  
112 files, 2393 examples, 4819 expectations, 191 failures, 72 errors

MRI 1.9.2 p290

Finished in 2.189125 seconds  
112 files, 2393 examples, 4922 expectations, 162 failures, 0 errors

Thanks, Orion

From: Tomas M. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
To: “[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
Date: 05/01/2012 05:59 p.m.  
Subject: Re: [Ironruby-core] Array Specs  
Sent by: [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

Cool! I?ll take a look asap.

Tomas

From: [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) [  
[mailto:removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)] On Behalf Of Orion E.  
Sent: Wednesday, January 04, 2012 1:54 PM  
To: [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
Subject: [Ironruby-core] Array Specs

I’ve been working on bringing IronRuby up to speed with rubyspec, and  
picked the core\array folder as a start:

My pull request is here:

> <https://github.com/IronLanguages/main/pull/52>
>
> Update IronRuby to pass more of rubyspec core/array specs

## I’d like to fix them all, but I’m not sure if I’ll have the time to do so

## Here is a summary of the rubyspec\core\array folder as of right now:

ok means the spec was already passing  
fixed means the spec was failing, and I have fixed it  
FAILS means the specs fail, and I have not fixed them yet

ok allocate\_spec.rb  
ok append\_spec.rb  
ok array\_spec.rb  
ok assoc\_spec.rb  
ok at\_spec.rb  
ok choice\_spec.rb  
ok clear\_spec.rb  
ok clone\_spec.rb  
ok collect\_spec.rb  
ok combination\_spec.rb  
ok compact\_spec.rb  
ok comparison\_spec.rb  
ok concat\_spec.rb  
ok constructor\_spec.rb  
ok count\_spec.rb  
ok cycle\_spec.rb  
ok delete\_at\_spec.rb  
ok delete\_if\_spec.rb  
ok delete\_spec.rb  
ok drop\_spec.rb  
ok drop\_while\_spec.rb  
ok dup\_spec.rb  
ok each\_index\_spec.rb  
ok each\_spec.rb  
ok element\_reference\_spec.rb  
fixed element\_set\_spec.rb  
ok empty\_spec.rb  
ok eql\_spec.rb  
ok equal\_value\_spec.rb  
ok fetch\_spec.rb  
fixed fill\_spec.rb  
ok find\_index\_spec.rb  
ok first\_spec.rb  
FAILS flatten\_spec.rb  
ok frozen\_spec.rb  
FAILS hash\_spec.rb  
ok include\_spec.rb  
ok indexes\_spec.rb  
ok index\_spec.rb  
ok indices\_spec.rb  
ok initialize\_copy\_spec.rb  
ok initialize\_spec.rb  
ok insert\_spec.rb  
FAILS inspect\_spec.rb  
ok intersection\_spec.rb  
FAILS join\_spec.rb  
FAILS keep\_if\_spec.rb  
ok last\_spec.rb  
ok length\_spec.rb  
ok map\_spec.rb  
ok minus\_spec.rb  
FAILS multiply\_spec.rb  
ok new\_spec.rb  
ok nitems\_spec.rb  
FAILS in MRI also pack\_spec.rb  
ok partition\_spec.rb  
ok permutation\_spec.rb  
ok plus\_spec.rb  
FAILS pop\_spec.rb  
!! HANGS product\_spec.rb  
ok push\_spec.rb  
ok rassoc\_spec.rb  
ok reject\_spec.rb  
FAILS repeated\_combination\_spec.rb  
FAILS repeated\_permutation\_spec.rb  
ok replace\_spec.rb  
ok reverse\_each\_spec.rb  
ok reverse\_spec.rb  
FAILS rindex\_spec.rb  
FAILS rotate\_spec.rb  
fixed sample\_spec.rb  
fixed select\_spec.rb  
fixed shift\_spec.rb  
fixed shuffle\_spec.rb  
ok size\_spec.rb  
FAILS slice\_spec.rb  
FAILS hard to fix sort\_by\_spec.rb  
FAILS hard to fix sort\_spec.rb  
ok take\_spec.rb  
ok take\_while\_spec.rb  
ok to\_ary\_spec.rb  
ok to\_a\_spec.rb  
ok to\_s\_spec.rb  
ok transpose\_spec.rb  
ok try\_convert\_spec.rb  
ok union\_spec.rb  
fixed uniq\_spec.rb  
ok unshift\_spec.rb  
ok values\_at\_spec.rb  
fixed zip\_spec.rb

---

<div class="post-metadata">

**Author:** ![Orion\_E](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/o/65b543/32.png) [@Orion\_E](https://www.ruby-forum.com/u/Orion_E)\
**Post date:** [February 1, 2012, 3:36am UTC](https://www.ruby-forum.com/t/array-specs/215452/4 "2012-02-01T03:36:07Z")

</div>

* * *

Ironruby-core mailing list  
removed\_email\_address@domain.invalid  
[http://rubyforge.org/mailman/listinfo/ironruby-core](http://rubyforge.org/mailman/listinfo/ironruby-core)
