ソースを参照

第一个版本

pull/1/head
llgoer 5年前
コミット
c172ecc4e8
3個のファイルの変更42行の追加0行の削除
  1. +11
    -0
      .gitignore
  2. +9
    -0
      Cargo.toml
  3. +22
    -0
      src/lib.rs

+ 11
- 0
.gitignore ファイルの表示

@@ -0,0 +1,11 @@
/target
**/*.rs.bk


#Added by cargo
#
#already existing elements are commented out

#/target
#**/*.rs.bk
Cargo.lock

+ 9
- 0
Cargo.toml ファイルの表示

@@ -0,0 +1,9 @@
[package]
name = "add"
version = "0.1.0"
authors = ["llgoer <llgoer@github.com>"]
edition = "2018"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]

+ 22
- 0
src/lib.rs ファイルの表示

@@ -0,0 +1,22 @@
// Copyright 2019 GoKeep Author. All rights reserved.
// license that can be found in the LICENSE file.

pub fn add(a: i32, b: i32) -> i32 {
a + b
}

#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_add() {
assert_eq!(add(1, 2), 3);
}


#[test]
fn it_works() {
assert_eq!(2 + 2, 4);
}
}

読み込み中…
キャンセル
保存