test: added test for reserve
This commit is contained in:
@@ -276,7 +276,7 @@ ArrayListErr arraylist_remove_at(ArrayList *arr, size_t index, void *out) {
|
||||
}
|
||||
|
||||
if (arr->len < 1) {
|
||||
return ARRLIST_OK;
|
||||
return ARRLIST_EMPTY;
|
||||
}
|
||||
|
||||
if (out != NULL) {
|
||||
@@ -359,11 +359,9 @@ ArrayListErr arraylist_reserve(ArrayList *arr, size_t size_to_reserve) {
|
||||
return ARRLIST_NULL_ARG;
|
||||
}
|
||||
|
||||
if (size_to_reserve < 1) {
|
||||
return ARRLIST_INVALID_CAPACITY;
|
||||
}
|
||||
if (arr->capacity + size_to_reserve > SIZE_MAX / arr->elem_size ||
|
||||
size_to_reserve > SIZE_MAX / arr->elem_size) {
|
||||
|
||||
if (arr->capacity + size_to_reserve > SIZE_MAX / arr->elem_size) {
|
||||
return ARRLIST_ALLOC_OVERFLOW;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user