Skip to content

Commit

Permalink
Review 2
Browse files Browse the repository at this point in the history
 * remove skips
 * remove main and set config directly
  • Loading branch information
ferhatelmas committed Oct 21, 2016
1 parent 73d930c commit 870f98e
Showing 1 changed file with 1 addition and 18 deletions.
19 changes: 1 addition & 18 deletions exercises/diamond/diamond_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,14 @@ package diamond

import (
"math/rand"
"os"
"reflect"
"strings"
"testing"
"testing/quick"
"time"
)

var config *quick.Config
var config = &quick.Config{Rand: rand.New(rand.NewSource(time.Now().UnixNano()))}

type correctChar byte

Expand Down Expand Up @@ -47,15 +46,13 @@ 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
}
checkCorrect(requirement, false, 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)
Expand All @@ -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 {
Expand All @@ -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)
Expand All @@ -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] {
Expand All @@ -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
Expand All @@ -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 {
Expand All @@ -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++ {
Expand All @@ -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-- {
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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())
}

0 comments on commit 870f98e

Please sign in to comment.