Don't use fmt where it's not needed

This commit is contained in:
Hamcha 2019-06-12 15:40:21 +02:00
parent 8dab3f112f
commit a5c9f40331
Signed by: hamcha
GPG Key ID: A40413D21021EAEE
4 changed files with 28 additions and 29 deletions

View File

@ -1,7 +1,6 @@
package mlp_test
import (
"fmt"
"testing"
"git.fromouter.space/mcg/draft"
@ -57,7 +56,7 @@ func TestAlternates(t *testing.T) {
}
}
if prurfound {
fmt.Printf("PR Ultra Rare found after %d packs\n", i)
t.Logf("PR Ultra Rare found after %d packs\n", i)
break
}
}
@ -78,7 +77,7 @@ func TestAlternates(t *testing.T) {
}
}
if cnurfound {
fmt.Printf("CN Ultra Rare found after %d packs\n", i)
t.Logf("CN Ultra Rare found after %d packs\n", i)
break
}
}
@ -92,7 +91,7 @@ func TestAlternates(t *testing.T) {
pack := draft.MakePack(eoSet)
// Check for royal rares
if pack[6].ID == "eo207/rr1" || pack[6].ID == "eo208/rr2" {
fmt.Printf("EO Royal Rare found after %d packs\n", i)
t.Logf("EO Royal Rare found after %d packs\n", i)
eorrfound = true
break
}

View File

@ -1,7 +1,6 @@
package mlp_test
import (
"fmt"
"testing"
"git.fromouter.space/mcg/draft"
@ -38,9 +37,9 @@ func TestDraftI8PCube(t *testing.T) {
t.Errorf("Expected 2 cards in pack 3 but got %d", len(pack3))
}
fmt.Printf("Cards in pack1: %s\n", pack1)
fmt.Printf("Cards in pack2: %s\n", pack2)
fmt.Printf("Cards in pack3: %s\n", pack3)
t.Logf("Cards in pack1: %s\n", pack1)
t.Logf("Cards in pack2: %s\n", pack2)
t.Logf("Cards in pack3: %s\n", pack3)
}
// TestDryCube tries drying up the cube to make the "OtherProvider" not able to pick a card

View File

@ -1,7 +1,6 @@
package mlp_test
import (
"fmt"
"testing"
"git.fromouter.space/mcg/draft"
@ -27,8 +26,8 @@ func TestSet(t *testing.T) {
t.Errorf("Expected 12 cards in pack 2 but got %d", len(pack2))
}
fmt.Printf("Cards in pack 1: %s\n", pack1)
fmt.Printf("Cards in pack 2: %s\n", pack2)
t.Logf("Cards in pack 1: %s\n", pack1)
t.Logf("Cards in pack 2: %s\n", pack2)
}
// TestWrongSet tries to fetch a set that doesn't exist

View File

@ -8,16 +8,27 @@ import (
"git.fromouter.space/mcg/draft"
)
const PACKSIZE = 5
// Test set that can be used by tests that don't need special features (like alternates)
var testSet = &draft.GenericSet{
Cards: []draft.Card{{ID: "a"}, {ID: "b"}, {ID: "c"}},
PackSize: PACKSIZE,
}
// Test cube that can be used by tests that don't need special features
var testCube = &draft.GenericCube{
Cards: []draft.Card{
{ID: "a"}, {ID: "b"}, {ID: "c"}, {ID: "d"}, {ID: "e"},
{ID: "f"}, {ID: "g"}, {ID: "h"}, {ID: "i"},
},
PackSize: PACKSIZE,
}
// TestSetRepeatable makes sure that a set can generate more cards than it contains
func TestSetRepeatable(t *testing.T) {
const PACKSIZE = 5
s := &draft.GenericSet{
Cards: []draft.Card{{ID: "a"}, {ID: "b"}, {ID: "c"}},
PackSize: PACKSIZE,
}
// Create a pack
pack := draft.MakePack(s)
pack := draft.MakePack(testSet)
if len(pack) < PACKSIZE {
t.Errorf("Pack expected to contain %d cards, contains %d", PACKSIZE, len(pack))
@ -77,17 +88,8 @@ func TestAlternateProviders(t *testing.T) {
// TestCubeOverflow makes sure cubes stop providing cards as they are exhausted instead of going out of bound
func TestCubeOverflow(t *testing.T) {
const PACKSIZE = 5
c := &draft.GenericCube{
Cards: []draft.Card{
{ID: "a"}, {ID: "b"}, {ID: "c"}, {ID: "d"}, {ID: "e"},
{ID: "f"}, {ID: "g"}, {ID: "h"}, {ID: "i"},
},
PackSize: PACKSIZE,
}
pack1 := draft.MakePack(c)
pack2 := draft.MakePack(c)
pack1 := draft.MakePack(testCube)
pack2 := draft.MakePack(testCube)
// Pack 2 can only contain 4 cards, as there are not enough cards to fill it
if len(pack2) >= PACKSIZE {