1 // Copyright 2021 Google LLC
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 //      http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14 //
15 ////////////////////////////////////////////////////////////////////////////////
16 
17 use super::*;
18 
19 #[test]
test_algorithm_conversion()20 fn test_algorithm_conversion() {
21     assert_eq!(Some(Algorithm::ES256), Algorithm::from_i64(-7));
22     assert_eq!(Some(Algorithm::A128GCM), Algorithm::from_i64(1));
23     assert_eq!(Algorithm::A128GCM as i64, 1);
24     assert_eq!(None, Algorithm::from_i64(8));
25     assert_eq!(None, Algorithm::from_i64(-65538));
26 }
27 
28 #[test]
test_header_param_private_range()29 fn test_header_param_private_range() {
30     assert!(!HeaderParameter::is_private(1));
31     assert!(HeaderParameter::is_private(-70_000));
32 }
33 
34 #[test]
test_elliptic_curve_private_range()35 fn test_elliptic_curve_private_range() {
36     assert!(!EllipticCurve::is_private(1));
37     assert!(EllipticCurve::is_private(-70_000));
38 }
39