mirror of https://github.com/kidoman/embd
ssd1306: making unit test go 1.6 compatible
This commit is contained in:
parent
903dc72cb7
commit
6e08978999
|
@ -37,15 +37,16 @@ func TestBufferHoriz_On(t *testing.T) {
|
||||||
pages := uint(2) // height = 16
|
pages := uint(2) // height = 16
|
||||||
|
|
||||||
for _, tt := range onTests {
|
for _, tt := range onTests {
|
||||||
t.Run(tt.name, func(t *testing.T) {
|
// Disabling testing Run use since this needs to build in go 1.6 also
|
||||||
buffer := newBufferHoriz(width, pages)
|
//t.Run(tt.name, func(t *testing.T) {
|
||||||
|
buffer := newBufferHoriz(width, pages)
|
||||||
|
|
||||||
buffer.On(tt.x, tt.y)
|
buffer.On(tt.x, tt.y)
|
||||||
|
|
||||||
if !reflect.DeepEqual(buffer.cells, tt.expected) {
|
if !reflect.DeepEqual(buffer.cells, tt.expected) {
|
||||||
t.Errorf("%s: wrong cell content, saw %v", tt.name, buffer.cells)
|
t.Errorf("%s: wrong cell content, saw %v", tt.name, buffer.cells)
|
||||||
}
|
}
|
||||||
})
|
//})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -54,14 +55,15 @@ func TestBufferHoriz_Set(t *testing.T) {
|
||||||
pages := uint(2) // height = 16
|
pages := uint(2) // height = 16
|
||||||
|
|
||||||
for _, tt := range onTests {
|
for _, tt := range onTests {
|
||||||
t.Run(tt.name, func(t *testing.T) {
|
// Disabling testing Run use since this needs to build in go 1.6 also
|
||||||
buffer := newBufferHoriz(width, pages)
|
//t.Run(tt.name, func(t *testing.T) {
|
||||||
buffer.Set(tt.x, tt.y, true)
|
buffer := newBufferHoriz(width, pages)
|
||||||
|
buffer.Set(tt.x, tt.y, true)
|
||||||
|
|
||||||
if !reflect.DeepEqual(buffer.cells, tt.expected) {
|
if !reflect.DeepEqual(buffer.cells, tt.expected) {
|
||||||
t.Errorf("%s: wrong cell content, saw %v", tt.name, buffer.cells)
|
t.Errorf("%s: wrong cell content, saw %v", tt.name, buffer.cells)
|
||||||
}
|
}
|
||||||
})
|
//})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -82,15 +84,16 @@ func TestBufferHoriz_FillRect(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, tt := range tests {
|
for _, tt := range tests {
|
||||||
t.Run(tt.name, func(t *testing.T) {
|
// Disabling testing Run use since this needs to build in go 1.6 also
|
||||||
buffer := newBufferHoriz(width, pages)
|
//t.Run(tt.name, func(t *testing.T) {
|
||||||
|
buffer := newBufferHoriz(width, pages)
|
||||||
|
|
||||||
buffer.FillRect(tt.x, tt.y, tt.width, tt.height)
|
buffer.FillRect(tt.x, tt.y, tt.width, tt.height)
|
||||||
|
|
||||||
if !reflect.DeepEqual(buffer.cells, tt.expected) {
|
if !reflect.DeepEqual(buffer.cells, tt.expected) {
|
||||||
t.Errorf("%s: wrong cell content, saw %v", tt.name, buffer.cells)
|
t.Errorf("%s: wrong cell content, saw %v", tt.name, buffer.cells)
|
||||||
}
|
}
|
||||||
})
|
//})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -109,18 +112,19 @@ func TestBufferHoriz_Off(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, tt := range tests {
|
for _, tt := range tests {
|
||||||
t.Run(tt.name, func(t *testing.T) {
|
// Disabling testing Run use since this needs to build in go 1.6 also
|
||||||
buffer := newBufferHoriz(width, pages)
|
//t.Run(tt.name, func(t *testing.T) {
|
||||||
|
buffer := newBufferHoriz(width, pages)
|
||||||
|
|
||||||
// assumes TestBufferHoriz_FillRect passes
|
// assumes TestBufferHoriz_FillRect passes
|
||||||
buffer.FillRect(0, 0, 8, 16)
|
buffer.FillRect(0, 0, 8, 16)
|
||||||
|
|
||||||
buffer.Off(tt.x, tt.y)
|
buffer.Off(tt.x, tt.y)
|
||||||
|
|
||||||
if !reflect.DeepEqual(buffer.cells, tt.expected) {
|
if !reflect.DeepEqual(buffer.cells, tt.expected) {
|
||||||
t.Errorf("%s: wrong cell content, saw %v", tt.name, buffer.cells)
|
t.Errorf("%s: wrong cell content, saw %v", tt.name, buffer.cells)
|
||||||
}
|
}
|
||||||
|
|
||||||
})
|
//})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue