blob: 19fca8c9e55e3abea12dbdc39d3a6974c061c3fd (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
#include <string.h>
#include "dged/buffer.h"
#include "assert.h"
#include "test.h"
void test_add() {
struct buffer b = buffer_create("test-buffer");
ASSERT(buffer_num_lines(&b) == 0, "Expected buffer to have zero lines");
const char *txt = "we are adding some text";
struct location loc = buffer_add(&b, (struct location){.line = 1, .col = 0},
(uint8_t *)txt, strlen(txt));
ASSERT(loc.line == 1 && loc.col == strlen(txt),
"Expected buffer to have one line with characters");
}
void run_buffer_tests() { run_test(test_add); }
|