-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
sudo fix-travis install pipenv from pip what are repos anyways why have the latest versions of packages in repos, what would be the use of that?! ~~or why not run ci on docker containers~~ We heard you liked dependencies so we added dependencies to your dependency manager Signing and verifying now done in rust instead of python Co-authored-by: Jonathan Dönszelmann <[email protected]> updated py-ipv8 formatted updated Pipfile dependencies install libssl to download pipenv dependencies add openssl install with pip3 python3.7 + pip ensure pip #42 fuck travis commit message courtesy of: Co-authored-by: Jonathan Dönszelmann <[email protected]> Travis docs were wrong, what a suprise guess updating ubuntu may help idk, kinda want to run gitlab-ci inside of travis now next up: what are version numbers anyway python without pip, c'mon travis are you even trying? why did you even make the 'python' command in your yml.... travis sucks ubuntu + travis sucks more how long will this go on for yes no getting salty y
- Loading branch information
Victor Roest
committed
Jun 22, 2019
1 parent
8730e5e
commit cdf1516
Showing
7 changed files
with
95 additions
and
5 deletions.
There are no files selected for viewing
This file contains 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Submodule py-ipv8
updated
4 files
+4 −0 | .gitignore | |
+23 −5 | ipv8/lazy_community.py | |
+2 −1 | ipv8/test/peerdiscovery/test_community.py | |
+1 −1 | run_all_tests_unix.sh |
This file contains 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 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 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,52 @@ | ||
//! Various utility functions to be used in conjunction with ipv8 | ||
use std::error::Error; | ||
|
||
create_error!(ConversionError, "Converting to a fixed size array failed."); | ||
|
||
/// Helper function types which have the [FromBytes](zerocopy::FromBytes) trait to be converted to some fixed size variant. | ||
/// Doesn't copy. | ||
pub fn as_fixed_size<T>(data: &[u8]) -> Result<&T, Box<dyn Error>> | ||
where | ||
T: zerocopy::FromBytes, | ||
{ | ||
Ok( | ||
(zerocopy::LayoutVerified::<_, T>::new(data).ok_or_else(|| Box::new(ConversionError))?) | ||
.into_ref(), | ||
) | ||
} | ||
|
||
#[cfg(test)] | ||
mod tests { | ||
use super::*; | ||
|
||
#[test] | ||
fn test_as_fixed_size_valid() { | ||
let data = &[0u8, 1u8, 2u8]; | ||
let fixed: [u8; 3] = *as_fixed_size(data).unwrap(); | ||
assert_eq!(fixed, [0u8, 1u8, 2u8]); | ||
} | ||
|
||
#[test] | ||
fn test_as_fixed_size_invalid_too_large() { | ||
let data = &[0u8, 1u8, 2u8]; | ||
let fixed: Result<&[u8; 4], Box<dyn Error>> = as_fixed_size(data); | ||
|
||
match fixed { | ||
Ok(_) => assert!(false), | ||
Err(_) => assert!(true), | ||
}; | ||
} | ||
|
||
#[test] | ||
fn test_as_fixed_size_invalid_too_small() { | ||
let data = &[0u8, 1u8, 2u8]; | ||
let fixed: Result<&[u8; 2], Box<dyn Error>> = as_fixed_size(data); | ||
|
||
match fixed { | ||
Ok(_) => assert!(false), | ||
Err(_) => assert!(true), | ||
}; | ||
} | ||
|
||
} |
This file contains 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