-
Notifications
You must be signed in to change notification settings - Fork 23
[23754] Remove compilation warning with InstanceHandle_t #262
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
Merged
+304
−37
Merged
Changes from 4 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
f34ffca
Refs #23753. Take into account dependencies for rebuild
richiware e7c88e0
Refs #23753. Fix warning
richiware d179b4b
Refs #23753. Remove swig warnings
richiware 10bfb67
Refs #23753. Add unit tests
richiware 698b7b2
Refs #23753. Apply suggestions
richiware File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
95 changes: 95 additions & 0 deletions
95
fastdds_python/test/unittest/dds/common/test_InstanceHandle.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,95 @@ | ||
| import fastdds | ||
| import pytest | ||
| import sys | ||
|
|
||
|
|
||
| def test_create_instance_handle_from_bytes(): | ||
| ih = fastdds.InstanceHandle_t() | ||
| ih.value = b"\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10" | ||
| assert (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16) == ih.value | ||
|
|
||
|
|
||
| def test_create_instance_handle_from_bytearray(): | ||
| ih = fastdds.InstanceHandle_t() | ||
| ih.value = bytearray([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]) | ||
| assert (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16) == ih.value | ||
|
|
||
|
|
||
| def test_create_instance_handle_from_tuple(): | ||
| ih = fastdds.InstanceHandle_t() | ||
| ih.value = (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16) | ||
| assert (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16) == ih.value | ||
|
|
||
|
|
||
| def test_create_instance_handle_from_list(): | ||
| ih = fastdds.InstanceHandle_t() | ||
| ih.value = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16] | ||
| assert (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16) == ih.value | ||
|
|
||
|
|
||
| def test_create_instance_handle_from_bytes_with_less_elements(): | ||
| ih = fastdds.InstanceHandle_t() | ||
| with pytest.raises(SystemError) as exception: | ||
| ih.value = b"\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e" | ||
| repr = exception.getrepr() | ||
| assert str(repr).split("\n")[0] == "ValueError: Expected 16 bytes" | ||
|
|
||
|
|
||
| def test_create_instance_handle_from_bytes_with_more_elements(): | ||
| ih = fastdds.InstanceHandle_t() | ||
| with pytest.raises(SystemError) as exception: | ||
| ih.value = ( | ||
| b"\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10\x11\x12" | ||
| ) | ||
| repr = exception.getrepr() | ||
| assert str(repr).split("\n")[0] == "ValueError: Expected 16 bytes" | ||
|
|
||
|
|
||
| def test_create_instance_handle_from_bytearray_with_less_elements(): | ||
| ih = fastdds.InstanceHandle_t() | ||
| with pytest.raises(SystemError) as exception: | ||
| ih.value = bytearray([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]) | ||
| repr = exception.getrepr() | ||
| assert str(repr).split("\n")[0] == "ValueError: Expected 16 bytes" | ||
|
|
||
|
|
||
| def test_create_instance_handle_from_bytearray_with_more_elements(): | ||
| ih = fastdds.InstanceHandle_t() | ||
| with pytest.raises(SystemError) as exception: | ||
| ih.value = bytearray( | ||
| [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18] | ||
| ) | ||
| repr = exception.getrepr() | ||
| assert str(repr).split("\n")[0] == "ValueError: Expected 16 bytes" | ||
|
|
||
|
|
||
| def test_create_instance_handle_from_tuple_with_less_elements(): | ||
| ih = fastdds.InstanceHandle_t() | ||
| with pytest.raises(SystemError) as exception: | ||
| ih.value = (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14) | ||
| repr = exception.getrepr() | ||
| assert str(repr).split("\n")[0] == "ValueError: Expected 16 elements" | ||
|
|
||
|
|
||
| def test_create_instance_handle_from_tuple_with_more_elements(): | ||
| ih = fastdds.InstanceHandle_t() | ||
| with pytest.raises(SystemError) as exception: | ||
| ih.value = (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18) | ||
| repr = exception.getrepr() | ||
| assert str(repr).split("\n")[0] == "ValueError: Expected 16 elements" | ||
|
|
||
|
|
||
| def test_create_instance_handle_from_list_with_less_elements(): | ||
| ih = fastdds.InstanceHandle_t() | ||
| with pytest.raises(SystemError) as exception: | ||
| ih.value = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14] | ||
| repr = exception.getrepr() | ||
| assert str(repr).split("\n")[0] == "ValueError: Expected 16 elements" | ||
|
|
||
|
|
||
| def test_create_instance_handle_from_list_with_more_elements(): | ||
| ih = fastdds.InstanceHandle_t() | ||
| with pytest.raises(SystemError) as exception: | ||
| ih.value = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18] | ||
| repr = exception.getrepr() | ||
| assert str(repr).split("\n")[0] == "ValueError: Expected 16 elements" |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.