Files
upstream-bleve/numeric/bin_test.go
upstream-mirror f8d3d9f0cf
Some checks failed
Coverage / coverage (push) Failing after 6s
Tests / test (1.24.x, ubuntu-latest) (push) Failing after 42s
Tests / test (1.26.x, ubuntu-latest) (push) Failing after 38s
Tests / test (1.25.x, ubuntu-latest) (push) Failing after 35s
Tests / test (1.25.x, windows-latest) (push) Has been cancelled
Tests / test (1.26.x, macos-latest) (push) Has been cancelled
Tests / test (1.26.x, windows-latest) (push) Has been cancelled
Tests / test (1.24.x, macos-latest) (push) Has been cancelled
Tests / test (1.24.x, windows-latest) (push) Has been cancelled
Tests / test (1.25.x, macos-latest) (push) Has been cancelled
snapshot of https://github.com/blevesearch/bleve.git (master, 2026-09-15; blobs > 131072B omitted)
2026-09-15 22:27:16 +05:00

28 lines
570 B
Go

package numeric
import "testing"
func TestInterleaveDeinterleave(t *testing.T) {
tests := []struct {
v1 uint64
v2 uint64
}{
{0, 0},
{1, 1},
{27, 39},
{1<<32 - 1, 1<<32 - 1}, // largest that should still work
}
for _, test := range tests {
i := Interleave(test.v1, test.v2)
gotv1 := Deinterleave(i)
gotv2 := Deinterleave(i >> 1)
if gotv1 != test.v1 {
t.Errorf("expected v1: %d, got %d, interleaved was %x", test.v1, gotv1, i)
}
if gotv2 != test.v2 {
t.Errorf("expected v2: %d, got %d, interleaved was %x", test.v2, gotv2, i)
}
}
}