rdseed 0.1.0-beta.11

Rust interface for RDRAND / RDSEED CPU instructions
Documentation
// This is free and unencumbered software released into the public domain.
// SPDX-License-Identifier: CC0-1.0 OR Unlicense

/* checks return value */
fn test_rdseed_retval<T: Into<u64>>(rc: Option<T>) {
   assert!(rc.is_some(), "call didn't get any result");
   assert!(rc.unwrap().into() != 0u64, "call got unexpected zero seed");
}

// tests for RDSEED

#[test]
fn get_one_rdseed64() {
   let rc = rdseed::get64();
   test_rdseed_retval(rc);
}

#[test]
fn get_one_rdseed32() {
   let rc = rdseed::get32();
   test_rdseed_retval(rc);
}

#[test]
fn get_one_rdseed16() {
   let rc = rdseed::get16();
   test_rdseed_retval(rc);
}

// tests for RDRAND

#[test]
fn get_one_rdrand64() {
   let rc = rdseed::rand::get64();
   test_rdseed_retval(rc);
}

#[test]
fn get_one_rdrand32() {
   let rc = rdseed::rand::get32();
   test_rdseed_retval(rc);
}

#[test]
fn get_one_rdrand16() {
   let rc = rdseed::rand::get16();
   test_rdseed_retval(rc);
}