penguin/golifehk

@golifehk bot in Telegram

datasources/cjlookup/humanumarts_test.go

raw · 631 bytes

package cjlookup

import (
	"testing"
)

func TestCUHARTLinks(t *testing.T) {
	s, err := Big5UrlParam("呀")
	if s != "%A7r" {
		t.Errorf("Faild to encode Big5 string: %A7r", err)
	}

	expect := "s1=c&s2=aang&s3=4"
	actual := SParams("caang4")
	if actual != expect {
		t.Errorf("SParams failed: expect %s, go %s", expect, actual)
	}

	expect = "s1=ng&s2=aau&s3=4"
	actual = SParams("ngaau4")
	if actual != expect {
		t.Errorf("SParams failed: expect %s, go %s", expect, actual)
	}

	expect = "s1=gw&s2=ong&s3=1"
	actual = SParams("gwong1")
	if actual != expect {
		t.Errorf("SParams failed: expect %s, go %s", expect, actual)
	}
}