summaryrefslogtreecommitdiffstats
path: root/vendor/elliptic-curve/tests/secret_key.rs
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/elliptic-curve/tests/secret_key.rs')
-rw-r--r--vendor/elliptic-curve/tests/secret_key.rs28
1 files changed, 28 insertions, 0 deletions
diff --git a/vendor/elliptic-curve/tests/secret_key.rs b/vendor/elliptic-curve/tests/secret_key.rs
new file mode 100644
index 0000000..a01de90
--- /dev/null
+++ b/vendor/elliptic-curve/tests/secret_key.rs
@@ -0,0 +1,28 @@
+//! Secret key tests
+
+#![cfg(feature = "dev")]
+
+use elliptic_curve::dev::SecretKey;
+
+#[test]
+fn from_slice_undersize() {
+ assert!(SecretKey::from_slice(&[]).is_err());
+}
+
+#[test]
+fn from_slice_expected_size() {
+ let bytes = [1u8; 32];
+ assert!(SecretKey::from_slice(&bytes).is_ok());
+}
+
+#[test]
+fn from_slice_allowed_short() {
+ let bytes = [1u8; 28];
+ assert!(SecretKey::from_slice(&bytes).is_ok());
+}
+
+#[test]
+fn from_slice_too_short() {
+ let bytes = [1u8; 27];
+ assert!(SecretKey::from_slice(&bytes).is_err());
+}