Skip to content

Commit

Permalink
replace main.rs demo with integration tests
Browse files Browse the repository at this point in the history
TODO unit and docs tests
  • Loading branch information
sneurlax committed Oct 12, 2024
1 parent dc103c8 commit a046d90
Show file tree
Hide file tree
Showing 5 changed files with 428 additions and 37 deletions.
150 changes: 150 additions & 0 deletions impls/monero.rs/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions impls/monero.rs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ crate-type = ["lib", "cdylib"]
[dependencies]
libc = "0.2"
libloading = "0.8.5"
mockall = "0.13.0"
tempfile = "3.13.0"

[build-dependencies]
bindgen = "0.70.1"
Expand Down
22 changes: 11 additions & 11 deletions impls/monero.rs/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,17 @@ use std::sync::Arc;

use libloading::{Library, Symbol};

#[cfg(target_os = "android")]
const LIB_NAME: &str = "libmonero_libwallet2_api_c.so";
#[cfg(target_os = "ios")]
const LIB_NAME: &str = "MoneroWallet.framework/MoneroWallet";
#[cfg(target_os = "linux")]
const LIB_NAME: &str = "monero_libwallet2_api_c.so";
#[cfg(target_os = "macos")]
const LIB_NAME: &str = "monero_libwallet2_api_c.dylib";
#[cfg(target_os = "windows")]
const LIB_NAME: &str = "monero_libwallet2_api_c.dll";

pub mod network {
use std::os::raw::c_int;
pub const MAINNET: c_int = 0;
Expand All @@ -28,17 +39,6 @@ pub struct WalletManager {
library: Library,
}

#[cfg(target_os = "android")]
const LIB_NAME: &str = "libmonero_libwallet2_api_c.so";
#[cfg(target_os = "ios")]
const LIB_NAME: &str = "MoneroWallet.framework/MoneroWallet";
#[cfg(target_os = "linux")]
const LIB_NAME: &str = "monero_libwallet2_api_c.so";
#[cfg(target_os = "macos")]
const LIB_NAME: &str = "monero_libwallet2_api_c.dylib";
#[cfg(target_os = "windows")]
const LIB_NAME: &str = "monero_libwallet2_api_c.dll";

impl WalletManager {
/// Creates a new `WalletManager`, loading the Monero wallet library (`wallet2_api_c`).
pub fn new(lib_path: Option<&str>) -> WalletResult<Arc<Self>> {
Expand Down
26 changes: 0 additions & 26 deletions impls/monero.rs/src/main.rs

This file was deleted.

Loading

0 comments on commit a046d90

Please sign in to comment.