2021-11-07 07:50:42 +00:00
|
|
|
package iid
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestSerialize(t *testing.T) {
|
|
|
|
|
2021-11-07 22:34:30 +00:00
|
|
|
for testNumber, test := range stdtests {
|
2021-11-07 07:50:42 +00:00
|
|
|
|
|
|
|
var serialized string = serialize(test.Value)
|
|
|
|
|
|
|
|
actual, successful := unserialize(serialized)
|
|
|
|
if !successful {
|
|
|
|
t.Errorf("For test #%d, expected unserialization of serialized data to be successful but wasn't." , testNumber)
|
|
|
|
t.Logf("SUCCESSFUL: %t", successful)
|
|
|
|
t.Logf("VALUE: %064b", test.Value)
|
|
|
|
continue
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if expected := test.Value; expected != actual {
|
|
|
|
t.Errorf("For test #%d, ", testNumber)
|
|
|
|
t.Logf("SUCCESSFUL: %t", successful)
|
|
|
|
t.Logf("EXPECTED: %064b", expected)
|
|
|
|
t.Logf("ACTUAL: %064b", actual)
|
|
|
|
continue
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|