#1183 "insert" method resizes CircularQueue w/o letting "size" know

v4.2.0
closed
None
complete
1
2014-04-15
2013-06-05
Erich
No

Method insert() will not only insert an item into a CircularQueue, but will also resize the queue by one item in such a way, that method size() doesn't recognize the change.

Sample code:

c=.CircularQueue~new(3)
do I=1 to 4
  c~push(I)
  say c '(items='c~items', size='c~size')'
end
c~insert(5,2)
say c '(items='c~items', size='c~size')'

Sample output:

1 (items=1, size=3)
2,1 (items=2, size=3)
3,2,1 (items=3, size=3)
4,3,2 (items=3, size=3)
4,3,5,2 (items=4, size=3)

There are now 4 items in a queue of size 3.

Discussion

  • Erich

    Erich - 2013-06-05

    Note that inherited method append() will show a similar issue as the one described above for insert().

     
  • Rick McGuire

    Rick McGuire - 2013-11-22
    • Group: 4.1.2 --> None
     
  • Rick McGuire

    Rick McGuire - 2013-11-23
    • Group: None --> v4.2.0
     
  • Rick McGuire

    Rick McGuire - 2013-11-24
    • status: open --> accepted
    • assigned_to: Rick McGuire
    • Pending work items: none --> doc+test
     
  • Rick McGuire

    Rick McGuire - 2013-11-24
    • Pending work items: doc+test --> tests
     
  • Rick McGuire

    Rick McGuire - 2013-12-02
    • status: accepted --> pending
    • Pending work items: tests --> complete
     
  • Rick McGuire

    Rick McGuire - 2013-12-02

    Tests committed [r9604]

     

    Related

    Commit: [r9604]

  • Rick McGuire

    Rick McGuire - 2014-04-15
    • status: pending --> closed
     


Anonymous

Cancel  Add attachments





Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks