Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
SWvheerden committed Sep 20, 2024
1 parent c79b577 commit 3d4c899
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 5 deletions.
23 changes: 18 additions & 5 deletions base_layer/wallet_ffi/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10296,6 +10296,7 @@ mod test {
0,
passphrase,
ptr::null(),
ptr::null(),
alice_network_str,
dns_string,
false,
Expand Down Expand Up @@ -10343,6 +10344,7 @@ mod test {
0,
passphrase,
ptr::null(),
ptr::null(),
alice_network_str,
dns_string,
false,
Expand Down Expand Up @@ -10460,6 +10462,7 @@ mod test {
0,
passphrase,
ptr::null(),
ptr::null(),
network_str,
dns_string,
false,
Expand Down Expand Up @@ -10591,9 +10594,9 @@ mod test {
// Try to wrongfully add a new seed word onto the mnemonic wordlist seed words object
let w = CString::new(mnemonic_wordlist[188]).unwrap();
let w_str: *const c_char = CString::into_raw(w) as *const c_char;
seed_words_push_word(mnemonic_wordlist_ffi, w_str, error_ptr);
seed_words_push_word(mnemonic_wordlist_ffi, w_str, ptr::null(), error_ptr);
assert_eq!(
seed_words_push_word(mnemonic_wordlist_ffi, w_str, error_ptr),
seed_words_push_word(mnemonic_wordlist_ffi, w_str, ptr::null(), error_ptr),
SeedWordPushResult::InvalidObject as u8
);
assert_ne!(error, 0);
Expand Down Expand Up @@ -10632,7 +10635,7 @@ mod test {
let w_str: *const c_char = CString::into_raw(w) as *const c_char;

assert_eq!(
seed_words_push_word(seed_words, w_str, error_ptr),
seed_words_push_word(seed_words, w_str, ptr::null(), error_ptr),
SeedWordPushResult::InvalidSeedWord as u8
);

Expand All @@ -10642,12 +10645,12 @@ mod test {

if count + 1 < 24 {
assert_eq!(
seed_words_push_word(seed_words, w_str, error_ptr),
seed_words_push_word(seed_words, w_str, ptr::null(), error_ptr),
SeedWordPushResult::SuccessfulPush as u8
);
} else {
assert_eq!(
seed_words_push_word(seed_words, w_str, error_ptr),
seed_words_push_word(seed_words, w_str, ptr::null(), error_ptr),
SeedWordPushResult::SeedPhraseComplete as u8
);
}
Expand Down Expand Up @@ -10688,6 +10691,7 @@ mod test {
0,
passphrase,
ptr::null(),
ptr::null(),
network_str,
dns_string,
false,
Expand Down Expand Up @@ -10755,6 +10759,7 @@ mod test {
0,
0,
passphrase,
ptr::null(),
seed_words,
network_str,
dns_string,
Expand Down Expand Up @@ -10836,6 +10841,7 @@ mod test {
0,
passphrase,
ptr::null(),
ptr::null(),
network_str,
dns_string,
false,
Expand Down Expand Up @@ -11014,6 +11020,7 @@ mod test {
0,
passphrase,
ptr::null(),
ptr::null(),
network_str,
dns_string,
false,
Expand Down Expand Up @@ -11153,6 +11160,7 @@ mod test {
0,
passphrase,
ptr::null(),
ptr::null(),
network_str,
dns_string,
false,
Expand Down Expand Up @@ -11372,6 +11380,7 @@ mod test {
0,
passphrase,
ptr::null(),
ptr::null(),
network_str,
dns_string,
false,
Expand Down Expand Up @@ -11599,6 +11608,7 @@ mod test {
0,
passphrase,
ptr::null(),
ptr::null(),
network_str,
dns_string,
false,
Expand Down Expand Up @@ -11860,6 +11870,7 @@ mod test {
0,
passphrase,
ptr::null(),
ptr::null(),
network_str,
dns_string,
false,
Expand Down Expand Up @@ -12241,6 +12252,7 @@ mod test {
0,
passphrase,
ptr::null(),
ptr::null(),
alice_network_str,
dns_string,
false,
Expand Down Expand Up @@ -12306,6 +12318,7 @@ mod test {
0,
passphrase,
ptr::null(),
ptr::null(),
bob_network_str,
dns_string,
false,
Expand Down
2 changes: 2 additions & 0 deletions base_layer/wallet_ffi/wallet.h
Original file line number Diff line number Diff line change
Expand Up @@ -1564,6 +1564,7 @@ char *seed_words_get_at(struct TariSeedWords *seed_words,
* ## Returns
* 'c_uchar' - Returns a u8 version of the `SeedWordPushResult` enum indicating whether the word was not a valid seed
* word, if the push was successful and whether the push was successful and completed the full Seed Phrase.
* `passphrase` - Optional passphrase to use when generating the seed phrase
* `seed_words` is only modified in the event of a `SuccessfulPush`.
* '0' -> InvalidSeedWord
* '1' -> SuccessfulPush
Expand Down Expand Up @@ -2865,6 +2866,7 @@ TariPublicKey *public_keys_get_at(const struct TariPublicKeys *public_keys,
* `passphrase` - An optional string that represents the passphrase used to
* encrypt/decrypt the databases for this wallet. If it is left Null no encryption is used. If the databases have been
* encrypted then the correct passphrase is required or this function will fail.
* `seed_passphrase` - an optional string, if present this will derypt the seed words
* `seed_words` - An optional instance of TariSeedWords, used to create a wallet for recovery purposes.
* If this is null, then a new master key is created for the wallet.
* `callback_received_transaction` - The callback function pointer matching the function signature. This will be
Expand Down

0 comments on commit 3d4c899

Please sign in to comment.