Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sequence->insertAt(index, elem) inserts elem at the wrong position #43

Closed
h-man2 opened this issue Sep 14, 2022 · 1 comment · Fixed by #44
Closed

Sequence->insertAt(index, elem) inserts elem at the wrong position #43

h-man2 opened this issue Sep 14, 2022 · 1 comment · Fixed by #44
Labels
bug Something isn't working good first issue Good for newcomers ocl conformance

Comments

@h-man2
Copy link
Contributor

h-man2 commented Sep 14, 2022

Describe the bug
The operation insertAt(index, elem) on type Sequence inserts the element elem at the wrong position:

?Sequence{7,8,9}->insertAt(1,42)
=> Sequence{7, 42, 8, 9}

The correct position would be the first position since OCL is 1 based 🥲 :

?Sequence{7,8,9}->insertAt(1,42)
=> Sequence{42, 7, 8, 9}

To Reproduce
Steps to reproduce the behavior:

  1. Go to shell
  2. Enter expression staring with ?
  3. See error

Expected behavior
The Element is put at the position using a 1-based Sequence instead of a 0-based one.

@h-man2 h-man2 added the bug Something isn't working label Sep 14, 2022
@h-man2
Copy link
Contributor Author

h-man2 commented Sep 14, 2022

Integration tests should be places in t001.in

h-man2 added a commit that referenced this issue Sep 15, 2022
- Fixed wrong check of precondition
- Fixed position of insert (0-based behavior of Java was ignored)
- Added documentation for Sequence()->insertAt() to the USE manual
- Added JavaDoc for insertAt
@h-man2 h-man2 linked a pull request Sep 15, 2022 that will close this issue
h-man2 added a commit that referenced this issue Sep 15, 2022
…erts-elem-at-the-wrong-position

Issue #43: Fix Sequence()->insertAt()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers ocl conformance
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant