-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.c
44 lines (37 loc) · 1.7 KB
/
test.c
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/* This is free and unencumbered software released into the public domain. */
#include "drylib.h"
#include <assert.h> /* for assert() */
#include <stdlib.h> /* for EXIT_SUCCESS */
////////////////////////////////////////////////////////////////////////////////
void
test_text_ascii(void) {
const dry_string_t* empty = dry_text_ascii_make_string("");
assert(dry_text_ascii_is_valid(empty) == true);
assert(dry_text_ascii_is_empty(empty) == true);
assert(dry_text_ascii_is_blank(empty) == false);
const dry_string_t* foobar = dry_text_ascii_make_string("foobar");
assert(dry_text_ascii_is_valid(foobar) == true);
assert(dry_text_ascii_is_empty(foobar) == false);
assert(dry_text_ascii_is_blank(foobar) == false);
assert(dry_text_ascii_contains(foobar, 'f') == true);
assert(dry_text_ascii_contains(foobar, 'r') == true);
assert(dry_text_ascii_contains(foobar, 'x') == false);
assert(dry_text_ascii_compare(foobar, foobar) == 0);
assert(dry_text_ascii_size(foobar) == 6);
assert(dry_text_ascii_length(foobar) == 6);
assert(dry_text_ascii_equals(foobar, foobar) == true);
assert(dry_text_ascii_nth(foobar, 0).has_value == true);
assert(dry_text_ascii_nth(foobar, 0).value == 'f');
assert(dry_text_ascii_nth(foobar, 5).has_value == true);
assert(dry_text_ascii_nth(foobar, 5).value == 'r');
assert(dry_text_ascii_nth(foobar, 6).has_value == false);
//assert(dry_text_ascii_starts_with(foobar, "")); // TODO
//assert(dry_text_ascii_ends_with(foobar, "")); // TODO
//assert(dry_text_ascii_contains(foobar, "")); // TODO
}
////////////////////////////////////////////////////////////////////////////////
int
main(int argc, char* argv[]) {
test_text_ascii();
return EXIT_SUCCESS; // TODO
}