File: test_buffer_substr.c

package info (click to toggle)
mle 1.7.2-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,108 kB
  • sloc: ansic: 13,335; sh: 728; php: 228; makefile: 83
file content (15 lines) | stat: -rw-r--r-- 387 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#include "test.h"

char *str = "hello\nworld";

void test(buffer_t *buf, mark_t *cur) {
    char *data;
    bint_t data_len;
    bint_t nchars;

    buffer_substr(buf, buf->first_line, 4, buf->first_line->next, 1, &data, &data_len, &nchars);
    ASSERT("datalen", 3, data_len);
    ASSERT("nchars", 3, nchars);
    ASSERT("substr", 0, strncmp("o\nw", data, data_len));
    free(data);
}