Skip to content

Commit

Permalink
add test to track down why its not parsing correctly.
Browse files Browse the repository at this point in the history
  • Loading branch information
JonathanHenson committed Oct 27, 2023
1 parent 7fe7aa2 commit ae51717
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
1 change: 1 addition & 0 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,7 @@ add_test_case(test_char_split_begins_with_token)
add_test_case(test_char_split_with_max_splits)
add_test_case(test_char_split_output_too_small)
add_test_case(test_byte_cursor_next_split)
add_test_case(test_byte_cursor_range_split_str)
add_test_case(test_buffer_cat)
add_test_case(test_buffer_cat_dest_too_small)
add_test_case(test_buffer_cpy)
Expand Down
19 changes: 19 additions & 0 deletions tests/split_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -329,3 +329,22 @@ static int s_test_byte_cursor_next_split(struct aws_allocator *allocator, void *

return 0;
}

AWS_TEST_CASE(test_byte_cursor_range_split_str, s_test_byte_cursor_range_split_str)
static int s_test_byte_cursor_range_split_str(struct aws_allocator *allocator, void *ctx) {
(void)allocator;
(void)ctx;

struct aws_byte_cursor to_split1 = AWS_BYTE_CUR_INIT_FROM_STRING_LITERAL("0-9");
struct aws_byte_cursor result1 = {0};
ASSERT_TRUE(aws_byte_cursor_next_split(&to_split1, '-', &result1));
ASSERT_CURSOR_VALUE_CSTRING_EQUALS(result1, "0");

ASSERT_TRUE(aws_byte_cursor_next_split(&to_split1, '1', &result1));
ASSERT_CURSOR_VALUE_CSTRING_EQUALS(result1, "9");

ASSERT_FALSE(aws_byte_cursor_next_split(&to_split1, '-', &result1));
ASSERT_CURSOR_VALUE_CSTRING_EQUALS(result1, "");

return 0;
}

0 comments on commit ae51717

Please sign in to comment.