...

Source file src/github.com/bits-and-blooms/bitset/popcnt_cmp_test.go

Documentation: github.com/bits-and-blooms/bitset

     1  // +build !go1.9
     2  // +build amd64,!appengine
     3  
     4  // This file tests the popcnt funtions
     5  
     6  package bitset
     7  
     8  import (
     9  	"testing"
    10  )
    11  
    12  func TestComparePopcntSlice(t *testing.T) {
    13  	s := []uint64{2, 3, 5, 7, 11, 13, 17, 19, 23, 29}
    14  	resGo := popcntSliceGo(s)
    15  	resAsm := popcntSliceAsm(s)
    16  	if resGo != resAsm {
    17  		t.Errorf("The implementations are different: GO %d != ASM %d", resGo, resAsm)
    18  	}
    19  }
    20  
    21  func TestComparePopcntMaskSlice(t *testing.T) {
    22  	s := []uint64{2, 3, 5, 7, 11, 13, 17, 19, 23, 29}
    23  	m := []uint64{31, 37, 41, 43, 47, 53, 59, 61, 67, 71}
    24  	resGo := popcntMaskSliceGo(s, m)
    25  	resAsm := popcntMaskSliceAsm(s, m)
    26  	if resGo != resAsm {
    27  		t.Errorf("The implementations are different: GO %d != ASM %d", resGo, resAsm)
    28  	}
    29  }
    30  
    31  func TestComparePopcntAndSlice(t *testing.T) {
    32  	s := []uint64{2, 3, 5, 7, 11, 13, 17, 19, 23, 29}
    33  	m := []uint64{31, 37, 41, 43, 47, 53, 59, 61, 67, 71}
    34  	resGo := popcntAndSliceGo(s, m)
    35  	resAsm := popcntAndSliceAsm(s, m)
    36  	if resGo != resAsm {
    37  		t.Errorf("The implementations are different: GO %d != ASM %d", resGo, resAsm)
    38  	}
    39  }
    40  
    41  func TestComparePopcntOrSlice(t *testing.T) {
    42  	s := []uint64{2, 3, 5, 7, 11, 13, 17, 19, 23, 29}
    43  	m := []uint64{31, 37, 41, 43, 47, 53, 59, 61, 67, 71}
    44  	resGo := popcntOrSliceGo(s, m)
    45  	resAsm := popcntOrSliceAsm(s, m)
    46  	if resGo != resAsm {
    47  		t.Errorf("The implementations are different: GO %d != ASM %d", resGo, resAsm)
    48  	}
    49  }
    50  
    51  func TestComparePopcntXorSlice(t *testing.T) {
    52  	s := []uint64{2, 3, 5, 7, 11, 13, 17, 19, 23, 29}
    53  	m := []uint64{31, 37, 41, 43, 47, 53, 59, 61, 67, 71}
    54  	resGo := popcntXorSliceGo(s, m)
    55  	resAsm := popcntXorSliceAsm(s, m)
    56  	if resGo != resAsm {
    57  		t.Errorf("The implementations are different: GO %d != ASM %d", resGo, resAsm)
    58  	}
    59  }
    60  

View as plain text