github.com/ncruces/go-sqlite3@v0.15.1-0.20240520133447-53eef1510ff0/ext/pivot/op_test.go (about)

     1  package pivot
     2  
     3  import (
     4  	"testing"
     5  
     6  	"github.com/ncruces/go-sqlite3"
     7  )
     8  
     9  func Test_operator(t *testing.T) {
    10  	tests := []struct {
    11  		op   sqlite3.IndexConstraintOp
    12  		want string
    13  	}{
    14  		{sqlite3.INDEX_CONSTRAINT_EQ, "="},
    15  		{sqlite3.INDEX_CONSTRAINT_LT, "<"},
    16  		{sqlite3.INDEX_CONSTRAINT_GT, ">"},
    17  		{sqlite3.INDEX_CONSTRAINT_LE, "<="},
    18  		{sqlite3.INDEX_CONSTRAINT_GE, ">="},
    19  		{sqlite3.INDEX_CONSTRAINT_NE, "<>"},
    20  		{sqlite3.INDEX_CONSTRAINT_IS, "IS"},
    21  		{sqlite3.INDEX_CONSTRAINT_ISNOT, "IS NOT"},
    22  		{sqlite3.INDEX_CONSTRAINT_REGEXP, "REGEXP"},
    23  		{sqlite3.INDEX_CONSTRAINT_MATCH, "MATCH"},
    24  		{sqlite3.INDEX_CONSTRAINT_GLOB, "GLOB"},
    25  		{sqlite3.INDEX_CONSTRAINT_LIKE, "LIKE"},
    26  	}
    27  	for _, tt := range tests {
    28  		t.Run(tt.want, func(t *testing.T) {
    29  			if got := operator(tt.op); got != tt.want {
    30  				t.Errorf("operator() = %v, want %v", got, tt.want)
    31  			}
    32  		})
    33  	}
    34  }