-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpokemon_test.go
54 lines (48 loc) · 1.09 KB
/
pokemon_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
package pokemon
import (
"testing"
)
func Test_GamePokemonRed(t *testing.T) {
game, err := GetGame("4")
if err != nil {
t.Error("Error: ", err)
} else {
t.Log("Passed: ", game.Name)
}
}
func Test_GameError(t *testing.T) {
game, err := GetGame("1231")
if err != nil {
t.Log("Passed: ", err)
} else {
t.Error("Error: ", game)
}
}
func Test_PokemonCharizardByName(t *testing.T) {
pokemon, err := GetPokemon("charizard")
if err != nil {
t.Error("Error: ", err)
} else if pokemon.Name != "Charizard" {
t.Error("Error: Wrong Pokemon???")
} else {
t.Log("Passed:", pokemon.Name, pokemon.National_id)
}
}
func Test_PokemonCharizardById(t *testing.T) {
pokemon, err := GetPokemon("6")
if err != nil {
t.Error("Error: ", err)
} else if pokemon.Name != "Charizard" {
t.Error("Error: Wrong Pokemon???")
} else {
t.Log("Passed: ", pokemon.Name, pokemon.National_id)
}
}
func Test_PokedexCallSuccess(t *testing.T) {
pokedex, err := GetPokedex("1")
if err != nil {
t.Error("Error: ", err)
} else {
t.Log("Passed :", pokedex.Name, " contains ", len(pokedex.Pokemon), " pokemon")
}
}