Artifact 5949178ed81a5db2d1e9e595e4d222399f9bfff8:
- File src/0dev.org/encoding/fibonacci/fib_test.go — part of check-in [7a1684ea05] at 2014-12-30 14:03:58 on branch trunk — Added encoding/fibonacci (cc: 100%) (user: spaskalev, size: 513) [annotate] [blame] [check-ins using]
package fibonacci import ( "testing" ) func TestNumbers(t *testing.T) { n := make(Numbers, 32) expected := []uint64{1, 1, 2, 3, 5, 8, 13, 21} for i, v := range expected { if f := n.Nth(i); f != v { t.Error("Unexpected value for", i, f, "expected", v) } } } func TestCoding(t *testing.T) { n := make(Numbers, 32) for i := uint64(0); i < 1024; i++ { enc := n.Code(i) dec := n.Decode(enc) if i != dec { t.Errorf("Unexpected value for %d - enc is %b, dec is %d\n", i, enc, dec) } } }