summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2015-04-06 03:19:12 -0400
committerJesse Luehrs <doy@tozt.net>2015-04-06 03:19:12 -0400
commit6c827b1db129cb4d60e4cc27d6f6759b79773aa2 (patch)
tree8fff468609b56b66cd1892793707e72c31989b08 /tests
parent6833c6891dedf36d8bce00a3637d6dabc3daa91e (diff)
downloadmatasano-6c827b1db129cb4d60e4cc27d6f6759b79773aa2.tar.gz
matasano-6c827b1db129cb4d60e4cc27d6f6759b79773aa2.zip
test helper to write files
Diffstat (limited to 'tests')
-rw-r--r--tests/util.rs5
1 files changed, 5 insertions, 0 deletions
diff --git a/tests/util.rs b/tests/util.rs
index 46ca46c..cd8014d 100644
--- a/tests/util.rs
+++ b/tests/util.rs
@@ -49,6 +49,11 @@ pub fn read (filename: &str) -> Vec<u8> {
return outfh.bytes().map(|c| c.unwrap()).collect();
}
+pub fn write (filename: &str, data: &[u8]) {
+ let mut outfh = File::create(filename).unwrap();
+ outfh.write(data).unwrap();
+}
+
pub fn random_aes_128_key () -> [u8; 16] {
let mut key = [0; 16];
self::rand::thread_rng().fill_bytes(&mut key);