-
Notifications
You must be signed in to change notification settings - Fork 0
/
main_test.go
84 lines (65 loc) · 1.53 KB
/
main_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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
package main
import (
"emcsrw/oapi"
"emcsrw/utils"
"testing"
)
func TestServerInfo(t *testing.T) {
t.SkipNow()
info, err := oapi.ServerInfo()
logVal(t, info, err)
}
func TestTown(t *testing.T) {
t.SkipNow()
town, err := oapi.Town("Venice")
logVal(t, town, err)
}
func TestNation(t *testing.T) {
t.SkipNow()
nation, err := oapi.Nation("Venice")
logVal(t, nation, err)
}
func TestResident(t *testing.T) {
t.SkipNow()
res, err := oapi.Resident("Fruitloopins")
logVal(t, res, err)
}
func TestConcurrentResidents(t *testing.T) {
t.SkipNow()
residents, _ := oapi.ConcurrentResidents([]string{"Owen3H", "Fruitloopins"})
logVal(t, residents, nil)
}
func TestAlphanumeric(t *testing.T) {
var actual bool
actual = utils.ContainsNonAlphanumeric("<blue> owen")
if actual != true {
t.Errorf("Expected '%v' but got '%v'", true, actual)
}
actual = utils.ContainsNonAlphanumeric("owen3h")
if actual != false {
t.Errorf("Expected '%v' but got '%v'", false, actual)
}
}
func TestWorldNationBal(t *testing.T) {
bal := oapi.WorldNationBalance()
logVal(t, bal, nil)
}
// func TestWorldBalances(t *testing.T) {
// worldBals, _ := oapi.WorldBalanceTotals(&oapi.BalanceOpts{
// Towns: true,
// Nations: true,
// })
// logVal(t, worldBals, nil)
// }
// func TestResidentNames(t *testing.T) {
// names, err := oapi.AllNames("/residents")
// //residents, _ := oapi.ConcurrentResidents(names)
// logVal(t, names, err)
// }
func logVal(t *testing.T, v any, e error) {
if e != nil {
t.Log(e)
} else {
t.Log(utils.Prettify(v))
}
}