@@ -31,68 +31,68 @@ pub fn input_compressed_accounts_signer_check(
31
31
)
32
32
}
33
33
34
- // #[cfg(test)]
35
- // mod test {
36
- // use anchor_lang::prelude:: borsh::BorshSerialize;
37
- // use light_compressed_account::compressed_account::{
38
- // CompressedAccount, PackedCompressedAccountWithMerkleContext,
39
- // };
40
- // use light_zero_copy::borsh::Deserialize;
34
+ #[ cfg( test) ]
35
+ mod test {
36
+ use borsh:: BorshSerialize ;
37
+ use light_compressed_account:: compressed_account:: {
38
+ CompressedAccount , PackedCompressedAccountWithMerkleContext ,
39
+ } ;
40
+ use light_zero_copy:: borsh:: Deserialize ;
41
41
42
- // use super::*;
42
+ use super :: * ;
43
43
44
- // #[test]
45
- // fn test_input_compressed_accounts_signer_check() {
46
- // let authority = Pubkey::new_unique();
44
+ #[ test]
45
+ fn test_input_compressed_accounts_signer_check ( ) {
46
+ let authority = solana_pubkey :: Pubkey :: new_unique ( ) . to_bytes ( ) ;
47
47
48
- // let compressed_account_with_context = PackedCompressedAccountWithMerkleContext {
49
- // compressed_account: CompressedAccount {
50
- // owner: authority,
51
- // ..CompressedAccount::default()
52
- // },
53
- // ..PackedCompressedAccountWithMerkleContext::default()
54
- // };
55
- // let bytes = compressed_account_with_context.try_to_vec().unwrap();
56
- // let compressed_account_with_context =
57
- // ZPackedCompressedAccountWithMerkleContext::zero_copy_at(&bytes)
58
- // .unwrap()
59
- // .0;
48
+ let compressed_account_with_context = PackedCompressedAccountWithMerkleContext {
49
+ compressed_account : CompressedAccount {
50
+ owner : authority,
51
+ ..CompressedAccount :: default ( )
52
+ } ,
53
+ ..PackedCompressedAccountWithMerkleContext :: default ( )
54
+ } ;
55
+ let bytes = compressed_account_with_context. try_to_vec ( ) . unwrap ( ) ;
56
+ let compressed_account_with_context =
57
+ ZPackedCompressedAccountWithMerkleContext :: zero_copy_at ( & bytes)
58
+ . unwrap ( )
59
+ . 0 ;
60
60
61
- // assert_eq!(
62
- // input_compressed_accounts_signer_check(
63
- // &[compressed_account_with_context.clone()],
64
- // &authority
65
- // ),
66
- // Ok(())
67
- // );
61
+ assert_eq ! (
62
+ input_compressed_accounts_signer_check(
63
+ & [ compressed_account_with_context. clone( ) ] ,
64
+ & authority
65
+ ) ,
66
+ Ok ( ( ) )
67
+ ) ;
68
68
69
- // {
70
- // let invalid_compressed_account_with_context =
71
- // PackedCompressedAccountWithMerkleContext {
72
- // compressed_account: CompressedAccount {
73
- // owner: Pubkey::new_unique(),
74
- // ..CompressedAccount::default()
75
- // },
76
- // ..PackedCompressedAccountWithMerkleContext::default()
77
- // };
69
+ {
70
+ let invalid_compressed_account_with_context =
71
+ PackedCompressedAccountWithMerkleContext {
72
+ compressed_account : CompressedAccount {
73
+ owner : solana_pubkey :: Pubkey :: new_unique ( ) . to_bytes ( ) ,
74
+ ..CompressedAccount :: default ( )
75
+ } ,
76
+ ..PackedCompressedAccountWithMerkleContext :: default ( )
77
+ } ;
78
78
79
- // let bytes = invalid_compressed_account_with_context
80
- // .try_to_vec()
81
- // .unwrap();
82
- // let invalid_compressed_account_with_context =
83
- // ZPackedCompressedAccountWithMerkleContext::zero_copy_at(&bytes)
84
- // .unwrap()
85
- // .0;
86
- // assert_eq!(
87
- // input_compressed_accounts_signer_check(
88
- // &[
89
- // compressed_account_with_context,
90
- // invalid_compressed_account_with_context
91
- // ],
92
- // &authority
93
- // ),
94
- // Err(SystemProgramError::SignerCheckFailed.into())
95
- // );
96
- // }
97
- // }
98
- // }
79
+ let bytes = invalid_compressed_account_with_context
80
+ . try_to_vec ( )
81
+ . unwrap ( ) ;
82
+ let invalid_compressed_account_with_context =
83
+ ZPackedCompressedAccountWithMerkleContext :: zero_copy_at ( & bytes)
84
+ . unwrap ( )
85
+ . 0 ;
86
+ assert_eq ! (
87
+ input_compressed_accounts_signer_check(
88
+ & [
89
+ compressed_account_with_context,
90
+ invalid_compressed_account_with_context
91
+ ] ,
92
+ & authority
93
+ ) ,
94
+ Err ( SystemProgramError :: SignerCheckFailed . into( ) )
95
+ ) ;
96
+ }
97
+ }
98
+ }
0 commit comments