Skip to content

Commit

Permalink
Run (most) common tests against the custom RNG
Browse files Browse the repository at this point in the history
Signed-off-by: Joe Richey <joerichey@google.com>
  • Loading branch information
josephlr committed Oct 22, 2022
1 parent 92af82a commit ee0ca47
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions tests/common/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ fn test_zero() {
}

#[test]
#[cfg(not(feature = "custom"))]
fn test_diff() {
let mut v1 = [0u8; 1000];
getrandom_impl(&mut v1).unwrap();
Expand Down
5 changes: 3 additions & 2 deletions tests/custom.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
))]

use wasm_bindgen_test::wasm_bindgen_test as test;
#[cfg(feature = "test-in-browser")]
wasm_bindgen_test::wasm_bindgen_test_configure!(run_in_browser);

use core::num::NonZeroU32;
use getrandom::{getrandom, register_custom_getrandom, Error};
Expand All @@ -33,6 +31,9 @@ fn super_insecure_rng(buf: &mut [u8]) -> Result<(), Error> {

register_custom_getrandom!(super_insecure_rng);

use getrandom::getrandom as getrandom_impl;
mod common;

#[test]
fn custom_rng_output() {
let mut buf = [0u8; 4];
Expand Down

0 comments on commit ee0ca47

Please sign in to comment.