mirror of
https://github.com/ascii-boxes/boxes.git
synced 2025-08-16 17:51:30 +02:00
Switch input
structure entirely to bxstring
This commit is contained in:
@ -28,6 +28,7 @@
|
||||
#include <string.h>
|
||||
|
||||
#include "boxes.h"
|
||||
#include "tools.h"
|
||||
#include "unicode.h"
|
||||
#include "unicode_test.h"
|
||||
|
||||
@ -158,4 +159,28 @@ void test_is_allowed_in_kv_string(void **state)
|
||||
}
|
||||
|
||||
|
||||
|
||||
void test_u32_strnrstr(void **state)
|
||||
{
|
||||
UNUSED(state);
|
||||
|
||||
uint32_t *haystack = u32_strconv_from_arg("a foo found found bar fou", "ASCII");
|
||||
assert_non_null(haystack);
|
||||
uint32_t *needle = u32_strconv_from_arg("found", "ASCII");
|
||||
assert_non_null(needle);
|
||||
|
||||
assert_null(u32_strnrstr(NULL, needle, u32_strlen(needle), 0));
|
||||
assert_ptr_equal(haystack, u32_strnrstr(haystack, NULL, 0, 0));
|
||||
|
||||
uint32_t *actual = u32_strnrstr(haystack, needle, u32_strlen(needle), 1);
|
||||
assert_ptr_equal(haystack + 6, actual);
|
||||
|
||||
actual = u32_strnrstr(haystack, needle, u32_strlen(needle), -1); /* -1 will be "fixed" to 0 */
|
||||
assert_ptr_equal(haystack + 12, actual);
|
||||
|
||||
BFREE(haystack);
|
||||
BFREE(needle);
|
||||
}
|
||||
|
||||
|
||||
/* vim: set cindent sw=4: */
|
Reference in New Issue
Block a user