Don't use fmt where it's not needed
This commit is contained in:
parent
8dab3f112f
commit
a5c9f40331
4 changed files with 28 additions and 29 deletions
|
@ -1,7 +1,6 @@
|
||||||
package mlp_test
|
package mlp_test
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"git.fromouter.space/mcg/draft"
|
"git.fromouter.space/mcg/draft"
|
||||||
|
@ -57,7 +56,7 @@ func TestAlternates(t *testing.T) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if prurfound {
|
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
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -78,7 +77,7 @@ func TestAlternates(t *testing.T) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if cnurfound {
|
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
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -92,7 +91,7 @@ func TestAlternates(t *testing.T) {
|
||||||
pack := draft.MakePack(eoSet)
|
pack := draft.MakePack(eoSet)
|
||||||
// Check for royal rares
|
// Check for royal rares
|
||||||
if pack[6].ID == "eo207/rr1" || pack[6].ID == "eo208/rr2" {
|
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
|
eorrfound = true
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package mlp_test
|
package mlp_test
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"git.fromouter.space/mcg/draft"
|
"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))
|
t.Errorf("Expected 2 cards in pack 3 but got %d", len(pack3))
|
||||||
}
|
}
|
||||||
|
|
||||||
fmt.Printf("Cards in pack1: %s\n", pack1)
|
t.Logf("Cards in pack1: %s\n", pack1)
|
||||||
fmt.Printf("Cards in pack2: %s\n", pack2)
|
t.Logf("Cards in pack2: %s\n", pack2)
|
||||||
fmt.Printf("Cards in pack3: %s\n", pack3)
|
t.Logf("Cards in pack3: %s\n", pack3)
|
||||||
}
|
}
|
||||||
|
|
||||||
// TestDryCube tries drying up the cube to make the "OtherProvider" not able to pick a card
|
// TestDryCube tries drying up the cube to make the "OtherProvider" not able to pick a card
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
package mlp_test
|
package mlp_test
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"git.fromouter.space/mcg/draft"
|
"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))
|
t.Errorf("Expected 12 cards in pack 2 but got %d", len(pack2))
|
||||||
}
|
}
|
||||||
|
|
||||||
fmt.Printf("Cards in pack 1: %s\n", pack1)
|
t.Logf("Cards in pack 1: %s\n", pack1)
|
||||||
fmt.Printf("Cards in pack 2: %s\n", pack2)
|
t.Logf("Cards in pack 2: %s\n", pack2)
|
||||||
}
|
}
|
||||||
|
|
||||||
// TestWrongSet tries to fetch a set that doesn't exist
|
// TestWrongSet tries to fetch a set that doesn't exist
|
||||||
|
|
38
set_test.go
38
set_test.go
|
@ -8,16 +8,27 @@ import (
|
||||||
"git.fromouter.space/mcg/draft"
|
"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
|
// TestSetRepeatable makes sure that a set can generate more cards than it contains
|
||||||
func TestSetRepeatable(t *testing.T) {
|
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
|
// Create a pack
|
||||||
pack := draft.MakePack(s)
|
pack := draft.MakePack(testSet)
|
||||||
|
|
||||||
if len(pack) < PACKSIZE {
|
if len(pack) < PACKSIZE {
|
||||||
t.Errorf("Pack expected to contain %d cards, contains %d", PACKSIZE, len(pack))
|
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
|
// TestCubeOverflow makes sure cubes stop providing cards as they are exhausted instead of going out of bound
|
||||||
func TestCubeOverflow(t *testing.T) {
|
func TestCubeOverflow(t *testing.T) {
|
||||||
const PACKSIZE = 5
|
pack1 := draft.MakePack(testCube)
|
||||||
c := &draft.GenericCube{
|
pack2 := draft.MakePack(testCube)
|
||||||
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)
|
|
||||||
|
|
||||||
// Pack 2 can only contain 4 cards, as there are not enough cards to fill it
|
// Pack 2 can only contain 4 cards, as there are not enough cards to fill it
|
||||||
if len(pack2) >= PACKSIZE {
|
if len(pack2) >= PACKSIZE {
|
||||||
|
|
Loading…
Reference in a new issue