Add math mod for lib

This commit is contained in:
2020-08-20 15:27:50 +07:00
parent 39101f2081
commit 0ae0b214bc
6 changed files with 35 additions and 12 deletions

7
math/.gitignore vendored Normal file
View File

@@ -0,0 +1,7 @@
/target
**/*.rs.bk
Cargo.lock
bin/
pkg/
wasm-pack.log
.cargo-ok

9
math/Cargo.toml Normal file
View File

@@ -0,0 +1,9 @@
[package]
name = "math"
version = "0.1.0"
authors = ["Sambo Chea <sombochea@cubetiqs.com>"]
edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]

16
math/src/lib.rs Normal file
View File

@@ -0,0 +1,16 @@
mod math {
#[allow(dead_code)]
pub fn sum(a: i32, b: i32) -> i32 {
a + b
}
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn it_works() {
assert_eq!(math::sum(10, 10), 20);
}
}