(t *testing.T)
| 502 | } |
| 503 | |
| 504 | func TestLinkBufferWriteDirect(t *testing.T) { |
| 505 | // clean & new |
| 506 | LinkBufferCap = 32 |
| 507 | |
| 508 | buf := NewLinkBuffer() |
| 509 | bt, _ := buf.Malloc(32) |
| 510 | bt[0] = 'a' |
| 511 | bt[1] = 'b' |
| 512 | buf.WriteDirect([]byte("cdef"), 30) |
| 513 | bt[2] = 'g' |
| 514 | buf.WriteDirect([]byte("hijkl"), 29) |
| 515 | bt[3] = 'm' |
| 516 | buf.WriteDirect([]byte("nopqrst"), 28) |
| 517 | bt[4] = 'u' |
| 518 | buf.WriteDirect([]byte("vwxyz"), 27) |
| 519 | copy(bt[5:], "abcdefghijklmnopqrstuvwxyza") |
| 520 | buf.WriteDirect([]byte("abcdefghijklmnopqrstuvwxyz"), 0) |
| 521 | buf.Flush() |
| 522 | bs := buf.Bytes() |
| 523 | str := "abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzaabcdefghijklmnopqrstuvwxyz" |
| 524 | for i := 0; i < len(str); i++ { |
| 525 | if bs[i] != str[i] { |
| 526 | t.Error("not equal!") |
| 527 | } |
| 528 | } |
| 529 | } |
| 530 | |
| 531 | func TestLinkBufferBufferMode(t *testing.T) { |
| 532 | bufnode := newLinkBufferNode(0) |
nothing calls this directly
no test coverage detected
searching dependent graphs…