diff --git a/static-array/static-array.go b/static-array/static-array.go new file mode 100644 index 0000000..ba2d9aa --- /dev/null +++ b/static-array/static-array.go @@ -0,0 +1,7 @@ +package main + + +func CreateArr() []int { + a := []int{1,2,5,7,9} + return a +} diff --git a/static-array/static-array_test.go b/static-array/static-array_test.go new file mode 100644 index 0000000..fac39fb --- /dev/null +++ b/static-array/static-array_test.go @@ -0,0 +1,16 @@ +package main + +import ( + "testing" + "reflect" +) + +func TestCreateArr(t *testing.T) { + got := CreateArr() + want:= []int{1,2,5,7,9} + + if !reflect.DeepEqual(got, want) { + t.Errorf("got %q want %q", got,want) + } +} +