github.com/insionng/yougam@v0.0.0-20170714101924-2bc18d833463/libraries/pingcap/go-hbase/result_test.go (about)

     1  package hbase
     2  
     3  import (
     4  	"strconv"
     5  
     6  	pb "github.com/insionng/yougam/libraries/golang/protobuf/proto"
     7  	. "github.com/insionng/yougam/libraries/pingcap/check"
     8  	"github.com/insionng/yougam/libraries/pingcap/go-hbase/proto"
     9  )
    10  
    11  type ResultTestSuit struct{}
    12  
    13  var _ = Suite(&ResultTestSuit{})
    14  
    15  func (s *ResultTestSuit) TestResultRow(c *C) {
    16  	var cells []*proto.Cell
    17  	for i := 1; i <= 10; i++ {
    18  		cell := &proto.Cell{
    19  			Row:       []byte("row"),
    20  			Family:    []byte("cf"),
    21  			Qualifier: []byte("q"),
    22  			Timestamp: pb.Uint64(uint64(i)),
    23  			CellType:  proto.CellType_PUT.Enum(),
    24  			Value:     []byte(strconv.Itoa(i)),
    25  		}
    26  		cells = append(cells, cell)
    27  	}
    28  	r := &proto.Result{
    29  		Cell: cells,
    30  	}
    31  
    32  	rr := NewResultRow(r)
    33  	c.Assert(rr.SortedColumns, HasLen, 1)
    34  	c.Assert(rr.SortedColumns[0].Values, HasLen, 10)
    35  	c.Assert(string(rr.SortedColumns[0].Value), Equals, "10")
    36  }