liuyuqi-dellpc 6 years ago
parent
commit
0b1bf08c77
5 changed files with 39 additions and 0 deletions
  1. 2 0
      .gitignore
  2. 12 0
      src/calc/calc.go
  3. 8 0
      src/simplemath/add.go
  4. 11 0
      src/simplemath/add_test.go
  5. 6 0
      src/simplemath/sqrt.go

+ 2 - 0
.gitignore

@@ -24,3 +24,5 @@ _testmain.go
 *.test
 *.prof
 
+/.idea
+/.project

+ 12 - 0
src/calc/calc.go

@@ -0,0 +1,12 @@
+package calc
+
+import "fmt"
+
+var Usage=func(){
+	 fmt.Println("USAGE: calc command [arguments] ...")
+	 fmt.Println("")
+	 fmt.Println("\nThe commands are:\n\tadd\tAddition of two values.\n\tsqrt\tSquares")
+}
+func main(){
+	
+}

+ 8 - 0
src/simplemath/add.go

@@ -0,0 +1,8 @@
+package simplemath
+
+import (
+
+)
+func Add(a int,b int) int{
+	return a+b
+}

+ 11 - 0
src/simplemath/add_test.go

@@ -0,0 +1,11 @@
+package simplemath
+
+import (
+	"testing"
+)
+func TestAdd(t *){
+	v :=Sqrt(16)
+	if v!=4{
+		t.Errorf()
+	}
+}

+ 6 - 0
src/simplemath/sqrt.go

@@ -0,0 +1,6 @@
+package simplemath
+
+import (
+
+)
+