Skip to content

Commit dbdc5de

Browse files
authored
Merge pull request #76 from ldorau/Make_all_names_of_functions_in_test_helpers.c_camelCase
Make all names of functions in test_helpers.c camelCase
2 parents e4b2600 + a8a1969 commit dbdc5de

File tree

3 files changed

+13
-10
lines changed

3 files changed

+13
-10
lines changed

test/common/test_helpers.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,17 @@
1818
#include "test_helpers.h"
1919

2020
// Check if the memory is filled with the given character
21-
int is_filled_with_char(void *ptr, size_t size, char c) {
21+
int bufferIsFilledWithChar(void *ptr, size_t size, char c) {
2222
char *mem = (char *)ptr;
2323
return (*mem == c) && memcmp(mem, mem + 1, size - 1) == 0;
2424
}
2525

2626
// Check if two memory regions has the same content
27-
int is_same_content(void *first, void *second, size_t size) {
27+
int buffersHaveSameContent(void *first, void *second, size_t size) {
2828
return memcmp(first, second, size) == 0;
2929
}
3030

31-
int is_aligned(void *ptr, size_t alignment) {
31+
int addressIsAligned(void *ptr, size_t alignment) {
3232
return ((uintptr_t)ptr & (alignment - 1)) == 0;
3333
}
3434

test/common/test_helpers.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,14 @@
1414
extern "C" {
1515
#endif
1616

17-
int is_filled_with_char(void *ptr, size_t size, char c);
17+
int bufferIsFilledWithChar(void *ptr, size_t size, char c);
1818

19-
int is_same_content(void *first, void *second, size_t size);
19+
int buffersHaveSameContent(void *first, void *second, size_t size);
2020

21-
int is_aligned(void *ptr, size_t alignment);
21+
int addressIsAligned(void *ptr, size_t alignment);
2222

2323
umf_memory_provider_handle_t nullProviderCreate(void);
24+
2425
umf_memory_provider_handle_t
2526
traceProviderCreate(umf_memory_provider_handle_t hUpstreamProvider,
2627
void (*trace)(const char *));

test/malloc_compliance_tests.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ void malloc_compliance_test(umf_memory_pool_handle_t hPool) {
6262
// For compatibility, on 64-bit systems malloc should align to 16 bytes
6363
size_t alignment =
6464
(sizeof(intptr_t) > 4 && alloc_ptr_size[i] > 8) ? 16 : 8;
65-
ASSERT_NE(is_aligned(alloc_ptr[i], alignment), 0)
65+
ASSERT_NE(addressIsAligned(alloc_ptr[i], alignment), 0)
6666
<< "Malloc should return pointer that is suitably aligned so that "
6767
"it may be assigned to a pointer to any type of object";
6868
#endif
@@ -74,7 +74,8 @@ void malloc_compliance_test(umf_memory_pool_handle_t hPool) {
7474
}
7575
for (int i = 0; i < ITERATIONS; i++) {
7676
ASSERT_NE(
77-
is_filled_with_char(alloc_ptr[i], alloc_ptr_size[i], i % 0xFF), 0)
77+
bufferIsFilledWithChar(alloc_ptr[i], alloc_ptr_size[i], i % 0xFF),
78+
0)
7879
<< "Object returned by malloc is not disjoined from others";
7980
memset(alloc_ptr[i], 1, alloc_ptr_size[i]);
8081
}
@@ -93,7 +94,7 @@ void calloc_compliance_test(umf_memory_pool_handle_t hPool) {
9394

9495
ASSERT_NE(alloc_ptr[i], nullptr)
9596
<< "calloc returned NULL, couldn't allocate much memory";
96-
ASSERT_NE(is_filled_with_char(alloc_ptr[i], alloc_size, 0), 0)
97+
ASSERT_NE(bufferIsFilledWithChar(alloc_ptr[i], alloc_size, 0), 0)
9798
<< "Memory returned by calloc was not zeroed";
9899
}
99100
free_memory(hPool, alloc_ptr);
@@ -131,7 +132,8 @@ void realloc_compliance_test(umf_memory_pool_handle_t hPool) {
131132

132133
// Reallocate with 100 byte size increasing
133134
realloc_ptr[i] = umfPoolRealloc(hPool, malloc_obj, alloc_size + 100);
134-
ASSERT_NE(is_same_content(realloc_ptr[i], saved_obj, alloc_size), 0)
135+
ASSERT_NE(buffersHaveSameContent(realloc_ptr[i], saved_obj, alloc_size),
136+
0)
135137
<< "Content after realloc should remain the same";
136138

137139
// Delete saved memory

0 commit comments

Comments
 (0)