1 // Copyright 2024 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 #![allow(clippy::unwrap_used)]
16 
17 use super::super::*;
18 use alloc::format;
19 use crypto_provider_default::CryptoProviderImpl;
20 
21 #[test]
section_identity_resolution_content_derives()22 fn section_identity_resolution_content_derives() {
23     let salt: ExtendedV1Salt = [0; 16].into();
24     let nonce = salt.compute_nonce::<CryptoProviderImpl>();
25     let token = CiphertextExtendedIdentityToken([0; 16]);
26     let section = SectionIdentityResolutionContents { identity_token: token, nonce };
27     assert_eq!(section, section);
28     let _ = format!("{:?}", section);
29 }
30 
31 #[test]
sig_encrypted_section_debug()32 fn sig_encrypted_section_debug() {
33     let ss = SignatureEncryptedSection {
34         contents: EncryptedSectionContents::new(
35             V1AdvHeader::new(0),
36             &[0],
37             [0x00; 16].into(),
38             [0x00; V1_IDENTITY_TOKEN_LEN].into(),
39             1,
40             &[0x00; 1],
41         ),
42     };
43     let _ = format!("{:?}", ss);
44 }
45 
46 #[test]
error_enum_debug_derives()47 fn error_enum_debug_derives() {
48     let mic_err = MicVerificationError::MicMismatch;
49     let _ = format!("{:?}", mic_err);
50 
51     let sig_err = SignatureVerificationError::SignatureMissing;
52     let _ = format!("{:?}", sig_err);
53 
54     let deser_err = DeserializationError::ArenaOutOfSpace::<MicVerificationError>;
55     let _ = format!("{:?}", deser_err);
56 
57     let err =
58         IdentityResolutionOrDeserializationError::IdentityMatchingError::<MicVerificationError>;
59     let _ = format!("{:?}", err);
60 }
61