Initial commit.

This commit is contained in:
rust-lang.xfoss.com
2023-03-27 14:33:48 +08:00
commit cf2b9a266c
266 changed files with 23587 additions and 0 deletions

8
adder/Cargo.toml Normal file
View File

@@ -0,0 +1,8 @@
[package]
name = "adder"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]

17
adder/src/lib.rs Normal file
View File

@@ -0,0 +1,17 @@
pub fn add_two(a: i32) -> i32 {
internal_add(a, 2)
}
fn internal_add(a: i32, b: i32) -> i32 {
a + b
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn internal() {
assert_eq! (4, internal_add(2, 2));
}
}

View File

@@ -0,0 +1,3 @@
pub fn setup() {
println! ("特定于库测试的一些设置代码,将放在这里");
}

View File

@@ -0,0 +1,9 @@
use adder;
mod common;
#[test]
fn it_adds_two() {
common::setup();
assert_eq! (6, adder::add_two(4));
}