From 971bd9aaa184b54b2766ad3c15b2608db1e57791 Mon Sep 17 00:00:00 2001 From: Ramakrishnan Muthukrishnan Date: Fri, 17 Feb 2023 15:11:11 +0530 Subject: [PATCH] initial test rust code --- rust/Cargo.toml | 12 ++++++++++++ rust/src/lib.rs | 17 +++++++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 rust/Cargo.toml create mode 100644 rust/src/lib.rs diff --git a/rust/Cargo.toml b/rust/Cargo.toml new file mode 100644 index 0000000..48363f2 --- /dev/null +++ b/rust/Cargo.toml @@ -0,0 +1,12 @@ +[package] +name = "hpsdr" +version = "0.1.0" +edition = "2021" +authors = ["Ramakrishnan Muthukrishnan "] + +[dependencies] +libc = "0.2" + +[lib] +name = "hpsdr" +crate-type = ["staticlib"] diff --git a/rust/src/lib.rs b/rust/src/lib.rs new file mode 100644 index 0000000..5d7f64a --- /dev/null +++ b/rust/src/lib.rs @@ -0,0 +1,17 @@ +use libc::{size_t}; + +#[no_mangle] +pub extern fn add(left: size_t, right: size_t) -> size_t { + left + right +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn it_works() { + let result = add(2, 2); + assert_eq!(result, 4); + } +} -- 2.45.2