Extracted test_fs_* from tests.c.
[agg.git] / tests_dev / fs.c
blob1c4dff44139469642f8029946d78fda8330b4622
1 #include "fs.h"
2 #include "../src/fs.h"
3 #include "../src/config.h"
4 #include <string.h>
6 int test_fs_buffer_sanity()
8 char buf[TEXT_BUFFER_SIZE];
9 fs_buffer(buf, "../../foo", TEXT_BUFFER_SIZE);
10 return strcmp("../../foo", buf) == 0;
13 int test_fs_buffer_fill_minus_one()
15 char exp[TEXT_BUFFER_SIZE] = { 0 };
16 char buf[TEXT_BUFFER_SIZE] = { 0 };
18 memset(exp, ' ', TEXT_BUFFER_SIZE - 2);
19 fs_buffer(buf, exp, TEXT_BUFFER_SIZE);
21 return strcmp(exp, buf) == 0;
24 int test_fs_buffer_fill()
26 char exp[TEXT_BUFFER_SIZE] = { 0 };
27 char buf[TEXT_BUFFER_SIZE] = { 0 };
29 memset(exp, ' ', TEXT_BUFFER_SIZE - 1);
30 fs_buffer(buf, exp, TEXT_BUFFER_SIZE);
32 return strcmp(exp, buf) == 0;
35 int test_fs_buffer_fill_plus_one()
37 char exp[TEXT_BUFFER_SIZE] = { 0 };
38 char buf[TEXT_BUFFER_SIZE] = { 0 };
39 char src[TEXT_BUFFER_SIZE + 1] = { 0 };
41 memset(exp, ' ', TEXT_BUFFER_SIZE - 1);
42 memset(src, ' ', TEXT_BUFFER_SIZE);
44 exp[TEXT_BUFFER_SIZE - 4] = '.';
45 exp[TEXT_BUFFER_SIZE - 3] = '.';
46 exp[TEXT_BUFFER_SIZE - 2] = '.';
48 fs_buffer(buf, src, TEXT_BUFFER_SIZE);
50 return strcmp(exp, buf) == 0;
53 int test_fs_item_set_title()
55 set_item_title("foo");
56 return 1;
59 int test_fs_item_get_title()
61 return strcmp("foo", get_item_title()) == 0;