github.com/keysonZZZ/kmg@v0.0.0-20151121023212-05317bfd7d39/encoding/kmgExcel/XlsxWriter_test.go (about)

     1  package kmgExcel
     2  
     3  import "testing"
     4  import "github.com/bronze1man/kmg/kmgTest"
     5  
     6  func TestCoordinateXy2Excel(ot *testing.T) {
     7  	t := kmgTest.NewTestTools(ot)
     8  	for _, c := range []struct {
     9  		x   int
    10  		y   int
    11  		out string
    12  	}{
    13  		{0, 0, "A1"},
    14  		{25, 0, "Z1"},
    15  		{25, 1000, "Z1001"},
    16  		{26, 1000, "AA1001"},
    17  		{27, 1000, "AB1001"},
    18  		{676, 0, "ZA1"},
    19  		{701, 0, "ZZ1"},
    20  		{702, 0, "AAA1"},
    21  		{703, 0, "AAB1"},
    22  		{728, 0, "ABA1"},
    23  	} {
    24  		t.Equal(CoordinateXy2Excel(c.x, c.y), c.out)
    25  	}
    26  }