-
Notifications
You must be signed in to change notification settings - Fork 6
640 Provide Vector( std::initializer_list<T> ) constructor #227
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
anyzelman
merged 13 commits into
develop
from
640-grb-vector-std-initializer_list-t-constructor
Feb 8, 2024
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
56f0ace
Signature declaration in base
byjtew b864062
Unit-test implementation
byjtew 51ad01e
Implementation in reference backend
byjtew be295d0
Implementation in nonblocking backend
byjtew 2a6529d
Implementation in hyperdags backend
byjtew 6bcb83a
Implementation in BSP1D backend
byjtew d0404a5
Review fixes
byjtew 2ade5e2
Code review, found one TODO / dependence on MR 233 to be resolved first
anyzelman 366e8b1
Small typo fix
anyzelman 967dc5e
Small typo fix
anyzelman 754671b
Minor unrelated warning suppressions
anyzelman c54f821
assignAll should call local_assignAll, and local_assignAll should be …
anyzelman 788858b
Revert earlier (and incorrect) change, meaning the assignedAll must h…
anyzelman 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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,80 @@ | ||
|
|
||
| /* | ||
| * Copyright 2021 Huawei Technologies Co., Ltd. | ||
| * | ||
| * Licensed under the Apache License, Version 2.0 (the "License"); | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
|
|
||
| #include <iostream> | ||
| #include <vector> | ||
|
|
||
| #include "graphblas.hpp" | ||
|
|
||
byjtew marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| using namespace grb; | ||
|
|
||
| void grbProgram( const void *, const size_t in_size, int &error ) { | ||
| if( in_size != 0 ) { | ||
| std::cerr << "Unit tests called with unexpected input" << std::endl; | ||
| error = 1; | ||
| return; | ||
| } | ||
| std::vector< int > values = { 4, 7, 4, 6, 4, 7, 1, 7, 3, 6, 7, 5, 1, 8, 7 }; | ||
| grb::Vector< int > x( { 4, 7, 4, 6, 4, 7, 1, 7, 3, 6, 7, 5, 1, 8, 7 } ); | ||
| bool equals = true; | ||
| auto vector_it = x.begin(); | ||
| for( size_t i = 0; i < values.size(); i++ ) { | ||
| if( vector_it == x.end() ) { | ||
| std::cerr << "Vector iterator prematurely in end position!" << std::endl; | ||
| error = 10; | ||
| return; | ||
| } | ||
| auto position = vector_it->first; | ||
| auto value = vector_it->second; | ||
| if( i != position || values[ i ] != value ) { | ||
| std::cerr << "Expected position " << i << " value " << values[ i ] | ||
| << " but got position " << position << " value " << value | ||
| << std::endl; | ||
| equals = false; | ||
| break; | ||
| } | ||
| (void) vector_it.operator++(); | ||
| } | ||
| if( !equals ) { | ||
| std::cerr << "Vector values are not correct" << std::endl; | ||
| error = 20; | ||
| return; | ||
| } | ||
| } | ||
|
|
||
| int main( int argc, char ** argv ) { | ||
| (void) argc; | ||
| std::cout << "Functional test executable: " << argv[ 0 ] << std::endl; | ||
|
|
||
| int error = 0; | ||
| grb::Launcher< AUTOMATIC > launcher; | ||
| if( launcher.exec( &grbProgram, NULL, 0, error ) != SUCCESS ) { | ||
| std::cout << "Test FAILED (test failed to launch)" << std::endl; | ||
| error = 255; | ||
| } | ||
| std::cerr << std::flush; | ||
| if( error == 0 ) { | ||
| std::cout << std::flush << "Test OK" << std::endl; | ||
| } else { | ||
| std::cout << std::flush << "Test FAILED" << std::endl; | ||
| } | ||
|
|
||
| // done | ||
| return error; | ||
| } | ||
|
|
||
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.