33 lines
508 B
Go
33 lines
508 B
Go
package oid36_test
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"code.icod.de/dalu/oid36"
|
|
)
|
|
|
|
func TestObjectIDToBase36(t *testing.T) {
|
|
oid := "617fc6a58149e807907dac6f"
|
|
exp := "2XBEMITFMZGGAZ8UC1B"
|
|
result, e := oid36.ObjectIDToBase36(oid)
|
|
if e != nil {
|
|
t.Error(e)
|
|
t.Fail()
|
|
return
|
|
}
|
|
if result != exp {
|
|
t.Fail()
|
|
return
|
|
}
|
|
}
|
|
|
|
func TestBase36ToObjectID(t *testing.T) {
|
|
bid := "2XBEMITFMZGGAZ8UC1B"
|
|
exp := "617fc6a58149e807907dac6f"
|
|
result := oid36.Base36ToObjectID(bid)
|
|
if result != exp {
|
|
t.Fail()
|
|
return
|
|
}
|
|
}
|