Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'generic/sodium/tests')
-rw-r--r--generic/sodium/tests/decrypter.rs40
-rw-r--r--generic/sodium/tests/encrypter.rs54
2 files changed, 43 insertions, 51 deletions
diff --git a/generic/sodium/tests/decrypter.rs b/generic/sodium/tests/decrypter.rs
index d9a34e4a1..cab580dd2 100644
--- a/generic/sodium/tests/decrypter.rs
+++ b/generic/sodium/tests/decrypter.rs
@@ -22,13 +22,6 @@
//
// SPDX-License-Identifier: MIT
-#[macro_use]
-extern crate lazy_static;
-#[macro_use]
-extern crate pretty_assertions;
-
-extern crate gstsodium;
-
use glib::prelude::*;
use gst::prelude::*;
@@ -36,22 +29,23 @@ use std::sync::{Arc, Mutex};
use std::path::PathBuf;
-lazy_static! {
- static ref SENDER_PUBLIC: glib::Bytes = {
- let public = [
- 66, 248, 199, 74, 216, 55, 228, 116, 52, 17, 147, 56, 65, 130, 134, 148, 157, 153, 235,
- 171, 179, 147, 120, 71, 100, 243, 133, 120, 160, 14, 111, 65,
- ];
- glib::Bytes::from_owned(public)
- };
- static ref RECEIVER_PRIVATE: glib::Bytes = {
- let secret = [
- 54, 221, 217, 54, 94, 235, 167, 2, 187, 249, 71, 31, 59, 27, 19, 166, 78, 236, 102, 48,
- 29, 142, 41, 189, 22, 146, 218, 69, 147, 165, 240, 235,
- ];
- glib::Bytes::from_owned(secret)
- };
-}
+use pretty_assertions::assert_eq;
+
+use once_cell::sync::Lazy;
+static SENDER_PUBLIC: Lazy<glib::Bytes> = Lazy::new(|| {
+ let public = [
+ 66, 248, 199, 74, 216, 55, 228, 116, 52, 17, 147, 56, 65, 130, 134, 148, 157, 153, 235,
+ 171, 179, 147, 120, 71, 100, 243, 133, 120, 160, 14, 111, 65,
+ ];
+ glib::Bytes::from_owned(public)
+});
+static RECEIVER_PRIVATE: Lazy<glib::Bytes> = Lazy::new(|| {
+ let secret = [
+ 54, 221, 217, 54, 94, 235, 167, 2, 187, 249, 71, 31, 59, 27, 19, 166, 78, 236, 102, 48, 29,
+ 142, 41, 189, 22, 146, 218, 69, 147, 165, 240, 235,
+ ];
+ glib::Bytes::from_owned(secret)
+});
fn init() {
use std::sync::Once;
diff --git a/generic/sodium/tests/encrypter.rs b/generic/sodium/tests/encrypter.rs
index beb1414a2..cbb653925 100644
--- a/generic/sodium/tests/encrypter.rs
+++ b/generic/sodium/tests/encrypter.rs
@@ -22,37 +22,35 @@
//
// SPDX-License-Identifier: MIT
-#[macro_use]
-extern crate lazy_static;
-extern crate gstsodium;
-
use glib::prelude::*;
use gst::prelude::*;
-lazy_static! {
- static ref RECEIVER_PUBLIC: glib::Bytes = {
- let public = [
- 28, 95, 33, 124, 28, 103, 80, 78, 7, 28, 234, 40, 226, 179, 253, 166, 169, 64, 78, 5,
- 57, 92, 151, 179, 221, 89, 68, 70, 44, 225, 219, 19,
- ];
-
- glib::Bytes::from_owned(public)
- };
- static ref SENDER_PRIVATE: glib::Bytes = {
- let secret = [
- 154, 227, 90, 239, 206, 184, 202, 234, 176, 161, 14, 91, 218, 98, 142, 13, 145, 223,
- 210, 222, 224, 240, 98, 51, 142, 165, 255, 1, 159, 100, 242, 162,
- ];
- glib::Bytes::from_owned(secret)
- };
- static ref NONCE: glib::Bytes = {
- let nonce = [
- 144, 187, 179, 230, 15, 4, 241, 15, 37, 133, 22, 30, 50, 106, 70, 159, 243, 218, 173,
- 22, 18, 36, 4, 45,
- ];
- glib::Bytes::from_owned(nonce)
- };
-}
+use once_cell::sync::Lazy;
+
+use pretty_assertions::assert_eq;
+
+static RECEIVER_PUBLIC: Lazy<glib::Bytes> = Lazy::new(|| {
+ let public = [
+ 28, 95, 33, 124, 28, 103, 80, 78, 7, 28, 234, 40, 226, 179, 253, 166, 169, 64, 78, 5, 57,
+ 92, 151, 179, 221, 89, 68, 70, 44, 225, 219, 19,
+ ];
+
+ glib::Bytes::from_owned(public)
+});
+static SENDER_PRIVATE: Lazy<glib::Bytes> = Lazy::new(|| {
+ let secret = [
+ 154, 227, 90, 239, 206, 184, 202, 234, 176, 161, 14, 91, 218, 98, 142, 13, 145, 223, 210,
+ 222, 224, 240, 98, 51, 142, 165, 255, 1, 159, 100, 242, 162,
+ ];
+ glib::Bytes::from_owned(secret)
+});
+static NONCE: Lazy<glib::Bytes> = Lazy::new(|| {
+ let nonce = [
+ 144, 187, 179, 230, 15, 4, 241, 15, 37, 133, 22, 30, 50, 106, 70, 159, 243, 218, 173, 22,
+ 18, 36, 4, 45,
+ ];
+ glib::Bytes::from_owned(nonce)
+});
fn init() {
use std::sync::Once;