package buf2d import ( "fmt" "strings" "testing" ) func TestSub(t *testing.T) { b := NewBuffer(10, 10, ' ') s := b.Sub(1, 1, b.Width()-1, b.Height()-1) b.Set(5, 1, 'a') s.Set(5, 5, 'b') WriteString(b, "Hello world", 1, 2) fmt.Println(b) fmt.Println(strings.Repeat("-", 10)) fmt.Println(s) } func TestSet(t *testing.T) { b := NewBuffer(0, 0, ' ') b.Set(0, 0, 'a') } func TestOffset(t *testing.T) { b := NewBuffer(10, 10, ' ') b = b.Sub(3, 3, 3, 3) fmt.Println(b.OffsetX(), b.OffsetY()) }