From 870f98e6689464802df7139a4cb696b7905dca19 Mon Sep 17 00:00:00 2001 From: ferhat elmas Date: Fri, 21 Oct 2016 11:12:13 +0200 Subject: [PATCH] Review 2 * remove skips * remove main and set config directly --- exercises/diamond/diamond_test.go | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) diff --git a/exercises/diamond/diamond_test.go b/exercises/diamond/diamond_test.go index 296083bd6..637287890 100644 --- a/exercises/diamond/diamond_test.go +++ b/exercises/diamond/diamond_test.go @@ -2,7 +2,6 @@ package diamond import ( "math/rand" - "os" "reflect" "strings" "testing" @@ -10,7 +9,7 @@ import ( "time" ) -var config *quick.Config +var config = &quick.Config{Rand: rand.New(rand.NewSource(time.Now().UnixNano()))} type correctChar byte @@ -47,7 +46,6 @@ func TestFirstRowContainsOneA(t *testing.T) { } func TestLastRowContainsOneA(t *testing.T) { - t.Skip("Remore to run test") requirement := func(char byte, rows []string) bool { return len(rows) > 0 && strings.Count(rows[len(rows)-1], "A") == 1 } @@ -55,7 +53,6 @@ func TestLastRowContainsOneA(t *testing.T) { } func TestAllRowsIdenticalLettersExceptFirstAndLast(t *testing.T) { - t.Skip("Remore to run test") requirement := func(char byte, rows []string) bool { for i, row := range rows { r := strings.TrimSpace(row) @@ -72,7 +69,6 @@ func TestAllRowsIdenticalLettersExceptFirstAndLast(t *testing.T) { } func TestAllRowsHaveSameTrailingSpaces(t *testing.T) { - t.Skip("Remore to run test") requirement := func(char byte, rows []string) bool { for _, row := range rows { if len(row) == 0 { @@ -90,7 +86,6 @@ func TestAllRowsHaveSameTrailingSpaces(t *testing.T) { } func TestDiamondIsHorizontallySymmetric(t *testing.T) { - t.Skip("Remore to run test") requirement := func(char byte, rows []string) bool { for _, row := range rows { l := len(row) @@ -106,7 +101,6 @@ func TestDiamondIsHorizontallySymmetric(t *testing.T) { } func TestDiamondIsVerticallySymmetric(t *testing.T) { - t.Skip("Remore to run test") requirement := func(char byte, rows []string) bool { for i, j := 0, len(rows)-1; i < j; i, j = i+1, j-1 { if rows[i] != rows[j] { @@ -119,7 +113,6 @@ func TestDiamondIsVerticallySymmetric(t *testing.T) { } func TestDiamondIsSquare(t *testing.T) { - t.Skip("Remore to run test") requirement := func(char byte, rows []string) bool { if int(char-'A')*2+1 != len(rows) { return false @@ -135,7 +128,6 @@ func TestDiamondIsSquare(t *testing.T) { } func TestDiamondHasItsShape(t *testing.T) { - t.Skip("Remore to run test") requirement := func(char byte, rows []string) bool { var n int for i, row := range rows { @@ -153,7 +145,6 @@ func TestDiamondHasItsShape(t *testing.T) { } func TestTopHalfHasAscendingLetters(t *testing.T) { - t.Skip("Remore to run test") requirement := func(char byte, rows []string) bool { var start byte = 'A' - 1 for i := 0; i <= len(rows)/2; i++ { @@ -169,7 +160,6 @@ func TestTopHalfHasAscendingLetters(t *testing.T) { } func TestBottomHalfHasDescendingLetters(t *testing.T) { - t.Skip("Remore to run test") requirement := func(char byte, rows []string) bool { var start byte = 'A' - 1 for i := len(rows) - 1; i > len(rows)/2; i-- { @@ -185,7 +175,6 @@ func TestBottomHalfHasDescendingLetters(t *testing.T) { } func TestDiamondFourCornersAreTriangle(t *testing.T) { - t.Skip("Remore to run test") requirement := func(char byte, rows []string) bool { notSpace := func(r rune) bool { return r <= 'Z' && r >= 'A' } var n int @@ -220,7 +209,6 @@ func (c wrongChar) Generate(rand *rand.Rand, _ int) reflect.Value { } func TestCharOutOfRangeShouldGiveError(t *testing.T) { - t.Skip("Remore to run test") assertion := func(char wrongChar) bool { _, err := Gen(byte(char)) return err != nil @@ -237,8 +225,3 @@ func TestTestVersion(t *testing.T) { t.Errorf("Found testVersion = %v, want %v.", testVersion, targetTestVersion) } } - -func TestMain(m *testing.M) { - config = &quick.Config{Rand: rand.New(rand.NewSource(time.Now().UnixNano()))} - os.Exit(m.Run()) -}