**resource.go/assets.go** * renamed `resources.go` to `assets.go` * added dark glyphs - located in assets.go -> assets/glyphs/dark/ * moved original glyphs - located in assets.go -> assets/glyph/light/ **glyphbanner.go** * added option to make glyphs vertical and/or dark **rpcg.go** * Added a random portal code generator this function takes no args and returns a string **README.md** * Fixed some typos (probably more to be fixed) * Added example of vertical portal banner * Added list of options for banner creation * Added example of ``nmslib.RndPortal()`` usage **go.mod** * updated go version to 1.16
91 lines
2.8 KiB
Go
91 lines
2.8 KiB
Go
package nmslib
|
|
|
|
import (
|
|
"fmt"
|
|
"testing"
|
|
)
|
|
|
|
func TestRndPortal(t *testing.T) {
|
|
fmt.Printf("\nRandom Portal Code: ")
|
|
fmt.Println(RndPortal())
|
|
}
|
|
|
|
func TestCreateBanner(t *testing.T) {
|
|
fmt.Printf("\nTesting CreateBanner: ")
|
|
CreateBanner(RndPortal(), "/tmp/Test.png", 11)
|
|
fmt.Printf("Random Portal address rendered as `/tmp/Test.png`\n\n")
|
|
}
|
|
|
|
func TestPortal2Galactic(t *testing.T) {
|
|
want, err := P2gc("006afa556c30")
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
if want != "042F:0079:0D55:006A" {
|
|
t.Errorf("Testing P2gc(\"006afa556c30\"): got %q, want: %q.\n", want, "042F:0079:0D55:006A")
|
|
} else {
|
|
fmt.Printf("Testing P2gc(\"006afa556c30\"): got: %q, want: %q.\n", want, "042F:0079:0D55:006A")
|
|
}
|
|
|
|
want, err = P2gc("41EDF9554C2F")
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
if want != "042E:0078:0D53:01ED" {
|
|
t.Errorf("Testing P2gc(\"41EDF9554C2F\"): got %q, want: %q.\n", want, "042E:0078:0D53:01ED")
|
|
} else {
|
|
fmt.Printf("Testing P2gc(\"41EDF9554C2F\"): got: %q, want: %q.\n", want, "042E:0078:0D53:01ED")
|
|
}
|
|
}
|
|
|
|
func TestGalactic2portal(t *testing.T) {
|
|
want, err := Gc2p("042F:0079:0D55:006A", 1)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
if want != "106AFA556C30" {
|
|
t.Errorf("\nTesting Gc2p(\"042F:0079:0D55:006A\"): got %q, want: %q.\n", want, "106AFA556C30")
|
|
} else {
|
|
fmt.Printf("\nTesting Gc2p(\"042F:0079:0D55:006A\"): got: %q, want: %q.\n", want, "106AFA556C30")
|
|
}
|
|
|
|
want, err = Gc2p("042E:0078:0D53:01ED", 4)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
if want != "41EDF9554C2F" {
|
|
t.Errorf("Testing Gc2p(\"042E:0078:0D53:01ED\"): got %q, want: %q.\n", want, "41EDF9554C2F")
|
|
} else {
|
|
fmt.Printf("Testing Gc2p(\"042E:0078:0D53:01ED\"): got: %q, want: %q.\n", want, "41EDF9554C2F")
|
|
}
|
|
}
|
|
|
|
func TestTranslate(t *testing.T) {
|
|
want := Translate{"Paka"}
|
|
if want.Atl2Eng() != "Awake" {
|
|
t.Errorf("\nTesting Translate{\"Paka\"}.Atl2Eng(): got %q, want: %q.\n", want.Atl2Eng(), "Awake")
|
|
} else {
|
|
fmt.Printf("\nTesting Translate{\"Paka\"}.Atl2Eng(): got %q, want: %q.\n", want.Atl2Eng(), "Awake")
|
|
}
|
|
want = Translate{"hofsos"}
|
|
if want.Gek2Eng() != "answer" {
|
|
t.Errorf("Testing Translate{\"hofsos\"}.Gek2Eng(): got %q, want: %q.\n", want.Gek2Eng(), "answer")
|
|
} else {
|
|
fmt.Printf("Testing Translate{\"hofsos\"}.Gek2Eng(): got %q, want: %q.\n", want.Gek2Eng(), "answer")
|
|
}
|
|
|
|
want = Translate{"Aqo"}
|
|
if want.Vyk2Eng() != "Foes" {
|
|
t.Errorf("Testing Translate{\"Aqo\"}.Vyk2Eng(): got %q, want: %q.\n", want.Vyk2Eng(), "Foes")
|
|
} else {
|
|
fmt.Printf("Testing Translate{\"Aqo\"}.Vyk2Eng(): got %q, want: %q.\n", want.Vyk2Eng(), "Foes")
|
|
}
|
|
want = Translate{"Alinichel"}
|
|
if want.Kor2Eng() != "Emergency" {
|
|
t.Errorf("Testing Translate{\"Alinichel\"}.Kor2Eng(): got %q, want: %q.\n", want.Kor2Eng(), "Emergency")
|
|
} else {
|
|
fmt.Printf("Testing Translate{\"Alinichel\"}.Kor2Eng(): got %q, want: %q.\n", want.Kor2Eng(), "Emergency")
|
|
}
|
|
fmt.Printf("\nTesting complete.\nStatus: ")
|
|
}
|