File: test_mark_cmp.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 (28 lines) | stat: -rw-r--r-- 742 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include "test.h"

char *str = "hello\nworld";

void test(buffer_t *buf, mark_t *cur) {
    mark_t *other, *first, *second;
    int cmp;
    other = buffer_add_mark(buf, NULL, 0);

    mark_move_beginning(cur);
    mark_move_end(other);
    cmp = mark_cmp(cur, other, &first, &second);
    ASSERT("a_cmp", -1, cmp);
    ASSERT("a_first", cur, first);
    ASSERT("a_second", other, second);

    mark_move_end(cur);
    mark_move_beginning(other);
    cmp = mark_cmp(cur, other, &first, &second);
    ASSERT("b_cmp", 1, cmp);
    ASSERT("b_first", other, first);
    ASSERT("b_second", cur, second);

    mark_move_beginning(cur);
    mark_move_beginning(other);
    cmp = mark_cmp(cur, other, &first, &second);
    ASSERT("c_cmp", 0, cmp);
}