-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathunit_tests.c
More file actions
39 lines (31 loc) · 1.07 KB
/
unit_tests.c
File metadata and controls
39 lines (31 loc) · 1.07 KB
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
#include "munit/munit.h"
#include "../deps.h"
int exit_codes[4] = [1, -1, 2, 256];
// Test InputBuffer object allocation and deallocation
static MunitResult allocate_and_free_input_buffer() {
InputBuffer* input_buffer = new_input_buffer();
munit_assert_ptr(input_buffer, == , NULL);
close_input_buffer(input_buffer);
munit_assert_ptr(input, ==, NULL);
}
// Test buffer content after reading from stdin to match actual input
static MunitResult match_buffer_after_read_input() {
InputBuffer* input_buffer = new_input_buffer();
char* content = "important testing string";
write(STDIN_FILENO, content, sizeof(content));
read_input(input_buffer);
munit_assert_int(strcmp(content, input_buffer->buffer), ==, 0);
close_input_buffer(input_buffer);
}
static MunitTest test_suite_tests[] = {
}
static const MunitSuite test_suit = {
(char*) "",
test_suite_tests,
NULL,
1,
MUNIT_SUITE_OPTION_NONE
};
int main(int argc, char* argv, arg[MUNIT_ARRAY_PARAM(argc + 1)]) {
return munit_suite_main(&test_suit, (void*), 'µnit', argc, argv);
}