wrapper/rust/: fix unit tests to avoid out-of-order wolfCrypt_Cleanup().
This commit is contained in:
@@ -50,6 +50,8 @@ pub mod sha;
|
||||
/// ```rust
|
||||
/// use wolfssl_wolfcrypt::*;
|
||||
/// wolfcrypt_init().expect("Error with wolfcrypt_init()");
|
||||
/// // ... use the library ...
|
||||
/// wolfcrypt_cleanup().expect("wolfCrypt_Cleanup failed");
|
||||
/// ```
|
||||
pub fn wolfcrypt_init() -> Result<(), i32> {
|
||||
let rc = unsafe { sys::wolfCrypt_Init() };
|
||||
@@ -66,12 +68,7 @@ pub fn wolfcrypt_init() -> Result<(), i32> {
|
||||
/// Returns either Ok(()) on success or Err(e) containing the wolfSSL
|
||||
/// library error code value.
|
||||
///
|
||||
/// # Example
|
||||
///
|
||||
/// ```rust
|
||||
/// use wolfssl_wolfcrypt::*;
|
||||
/// wolfcrypt_cleanup().expect("Error with wolfcrypt_cleanup()");
|
||||
/// ```
|
||||
/// See also: [`wolfcrypt_init`]
|
||||
pub fn wolfcrypt_cleanup() -> Result<(), i32> {
|
||||
let rc = unsafe { sys::wolfCrypt_Cleanup() };
|
||||
if rc != 0 {
|
||||
|
||||
@@ -1,11 +1,7 @@
|
||||
use wolfssl_wolfcrypt::*;
|
||||
|
||||
#[test]
|
||||
fn test_wolfcrypt_init() {
|
||||
fn test_wolfcrypt_init_and_cleanup() {
|
||||
wolfcrypt_init().expect("Error with wolfcrypt_init()");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_wolfcrypt_cleanup() {
|
||||
wolfcrypt_cleanup().expect("Error with wolfcrypt_cleanup()");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user