Add string buffer macro and tests for Str8
This commit is contained in:
parent
bfb4e87a1e
commit
8f10ac2916
@ -14,6 +14,8 @@ struct str8 {
|
|||||||
u8 *buf;
|
u8 *buf;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#define wapp_str8_buf(CAPACITY) ((Str8){.capacity = CAPACITY, .size = 0, .buf = (u8[CAPACITY]){0}})
|
||||||
|
|
||||||
Str8 wapp_str8_lit(char *str);
|
Str8 wapp_str8_lit(char *str);
|
||||||
char wapp_str8_get(const Str8 *str, u64 index);
|
char wapp_str8_get(const Str8 *str, u64 index);
|
||||||
void wapp_str8_set(Str8 *str, u64 index, char c);
|
void wapp_str8_set(Str8 *str, u64 index, char c);
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
#include "str8/test_str8.h"
|
||||||
#include "test_allocator.h"
|
#include "test_allocator.h"
|
||||||
#include "test_arena.h"
|
#include "test_arena.h"
|
||||||
#include "test_cpath.h"
|
#include "test_cpath.h"
|
||||||
@ -5,13 +6,16 @@
|
|||||||
#include "tester.h"
|
#include "tester.h"
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int main(void) {
|
int main(void) {
|
||||||
wapp_tester_run_tests(test_libc_allocator, test_arena_allocator, test_arena_init,
|
wapp_tester_run_tests(test_libc_allocator, test_arena_allocator, test_arena_init,
|
||||||
test_arena_init_succeeds_when_reserving_very_large_size, test_cpath_join_path,
|
test_arena_init_succeeds_when_reserving_very_large_size, test_str8_lit,
|
||||||
test_cpath_dirname, test_cpath_dirup, test_arena_alloc_succeeds_when_within_capacity,
|
test_str8_buf, test_str8_get_index_within_bounds, test_str8_get_index_out_of_bounds,
|
||||||
test_arena_alloc_fails_when_over_capacity, test_arena_realloc_bigger_size,
|
test_str8_set, test_cpath_join_path, test_cpath_dirname, test_cpath_dirup,
|
||||||
test_arena_realloc_smaller_size, test_arena_clear, test_arena_destroy,
|
test_arena_alloc_succeeds_when_within_capacity, test_arena_alloc_fails_when_over_capacity,
|
||||||
test_commander_cmd_success, test_commander_cmd_failure,
|
test_arena_realloc_bigger_size, test_arena_realloc_smaller_size, test_arena_clear,
|
||||||
|
test_arena_destroy, test_commander_cmd_success, test_commander_cmd_failure,
|
||||||
test_commander_cmd_out_buf_success, test_commander_cmd_out_buf_failure);
|
test_commander_cmd_out_buf_success, test_commander_cmd_out_buf_failure);
|
||||||
|
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
|
Loading…
Reference in New Issue
Block a user