-
Notifications
You must be signed in to change notification settings - Fork 130
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
Test each type for having the expected default operations #3964
Comments
BTW, I won't be surprised if some of our inheritable classes do currently have a default copy constructor and assignment, and we should |
Hello, is this issue still available for assignment? |
As far as I know, it is. |
@tmrna, thank you for your interest! |
Subsequent issue - #4657. |
## 1.10.0 (2023-06-01) ### Features Added - Added `Azure::Core::Uuid::AsArray()` and `Azure::Core::Uuid::CreateFromArray()` to enable reading or writing from an existing UUID. This is useful when the UUID was generated outside the Azure SDK, or needs to be used from a component outside the Azure SDK. ### Other Changes - [[microsoft#3964]](Azure/azure-sdk-for-cpp#3964) Ensuring some Azure SDK types have the expected default operations. (A community contribution, courtesy of _[jnyfah](https://github.com/jnyfah)_) ### Acknowledgments Thank you to our developer community members who helped to make Azure Core better with their contributions to this release: - Jennifer Chukwu _([GitHub](https://github.com/jnyfah))_
## 1.10.0 (2023-06-01) ### Features Added - Added `Azure::Core::Uuid::AsArray()` and `Azure::Core::Uuid::CreateFromArray()` to enable reading or writing from an existing UUID. This is useful when the UUID was generated outside the Azure SDK, or needs to be used from a component outside the Azure SDK. ### Other Changes - [[#3964]](Azure/azure-sdk-for-cpp#3964) Ensuring some Azure SDK types have the expected default operations. (A community contribution, courtesy of _[jnyfah](https://github.com/jnyfah)_) ### Acknowledgments Thank you to our developer community members who helped to make Azure Core better with their contributions to this release: - Jennifer Chukwu _([GitHub](https://github.com/jnyfah))_
It is possible to write a test helper that checks for the type to have copy constructor, move constructor, and so on.
Then, for each type, we can have one extra unit test that checks whether a type has or hasn't copy constructor as expected and so on.
One way is to check it semantically, but then I think we can't test for move/vs copy and so on. But the benefit is that we can write a test that verifies that copying and assignment works exactly as we expect. Plus there's an argument that we really care about semantics and not the actual way it is implemented.
But it is not possible to generalize copy constructor and assignment verfication, for each class such testcases would need to be written individually.
Second approach - and we can combine both approaches at the same time - second approach, would be to write a templated test helper to which you tell what operations you expect the type to have, and it will verify that your expectations are true.
We can do so without a test helper, and just repeat most of the statements for each class, but still the sense is the same - to use
type_traits
.Check out what
type_traits
have: https://en.cppreference.com/w/cpp/header/type_traitsis_constructible
is_trivially_constructible
is_nothrow_constructible
is_default_constructible
is_trivially_default_constructible
is_nothrow_default_constructible
is_copy_constructible
is_trivially_copy_constructible
is_nothrow_copy_constructible
is_move_constructible
is_trivially_move_constructible
is_nothrow_move_constructible
is_assignable
is_trivially_assignable
is_nothrow_assignable
is_copy_assignable
is_trivially_copy_assignable
is_nothrow_copy_assignable
is_move_assignable
is_trivially_move_assignable
is_nothrow_move_assignable
is_destructible
is_trivially_destructible
is_nothrow_destructible
has_virtual_destructor
is_swappable_with
is_swappable
is_nothrow_swappable_with
is_nothrow_swappable
The text was updated successfully, but these errors were encountered: