-
Notifications
You must be signed in to change notification settings - Fork 9
Fix stdlib interop #31
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| /** test-interop.cpp | ||
| * | ||
| * This software may be modified and distributed under the terms | ||
| * of the MIT license. See the LICENSE file for details. | ||
| * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ | ||
|
|
||
| #include "unit_test_common.hpp" | ||
|
|
||
| #include <array> | ||
| #include <valarray> | ||
| #include <vector> | ||
|
|
||
| GCH_SMALL_VECTOR_TEST_CONSTEXPR | ||
| int | ||
| test (void) | ||
| { | ||
| std::vector<int> src_vec { 1, 2, 3, 4 }; | ||
| gch::small_vector<int, 2> from_vec (src_vec.begin (), src_vec.end ()); | ||
| CHECK (from_vec.size () == src_vec.size ()); | ||
| CHECK (std::equal (src_vec.begin (), src_vec.end (), from_vec.begin ())); | ||
|
|
||
| std::array<int, 4> src_arr { 5, 6, 7, 8 }; | ||
| gch::small_vector<int, 2> from_arr; | ||
| from_arr.assign (src_arr.begin (), src_arr.end ()); | ||
| CHECK (from_arr.size () == src_arr.size ()); | ||
| CHECK (std::equal (src_arr.begin (), src_arr.end (), from_arr.begin ())); | ||
|
|
||
| const std::valarray<int> src_val { 9, 10, 11, 12 }; | ||
| gch::small_vector<int, 2> from_val; | ||
| from_val.assign (std::begin (src_val), std::end (src_val)); | ||
| CHECK (from_val.size () == src_val.size ()); | ||
| CHECK (std::equal (std::begin (src_val), std::end (src_val), from_val.begin ())); | ||
|
Comment on lines
+28
to
+32
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Agreed, I'll give that a shot. Sorry it took so long to get back to this, life caught up with me.
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No worries, life happens! If that doesn't work, could you rename this file to like |
||
|
|
||
| return 0; | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.