mirror of
https://github.com/jerryscript-project/jerryscript.git
synced 2025-12-15 16:29:21 +00:00
Renaming camelCase-named identifiers in unit tests' code.
This commit is contained in:
parent
1796b9d903
commit
0eea67ceb2
@ -34,7 +34,7 @@ main( int __unused argc,
|
|||||||
getop_exitval( 0)
|
getop_exitval( 0)
|
||||||
};
|
};
|
||||||
|
|
||||||
mem_Init();
|
mem_init();
|
||||||
|
|
||||||
init_int( test_program);
|
init_int( test_program);
|
||||||
|
|
||||||
|
|||||||
@ -35,7 +35,7 @@ main( int __unused argc,
|
|||||||
getop_exitval( 0)
|
getop_exitval( 0)
|
||||||
};
|
};
|
||||||
|
|
||||||
mem_Init();
|
mem_init();
|
||||||
|
|
||||||
init_int( test_program);
|
init_int( test_program);
|
||||||
|
|
||||||
|
|||||||
@ -34,7 +34,7 @@ main( int __unused argc,
|
|||||||
getop_exitval( 0)
|
getop_exitval( 0)
|
||||||
};
|
};
|
||||||
|
|
||||||
mem_Init();
|
mem_init();
|
||||||
|
|
||||||
init_int( test_program);
|
init_int( test_program);
|
||||||
|
|
||||||
|
|||||||
@ -40,14 +40,14 @@ main( int __unused argc,
|
|||||||
{
|
{
|
||||||
uint8_t test_native_heap[test_heap_size];
|
uint8_t test_native_heap[test_heap_size];
|
||||||
|
|
||||||
mem_HeapInit( test_native_heap, sizeof (test_native_heap));
|
mem_heap_init( test_native_heap, sizeof (test_native_heap));
|
||||||
|
|
||||||
srand((unsigned int) time(NULL));
|
srand((unsigned int) time(NULL));
|
||||||
int k = rand();
|
int k = rand();
|
||||||
printf("seed=%d\n", k);
|
printf("seed=%d\n", k);
|
||||||
srand((unsigned int) k);
|
srand((unsigned int) k);
|
||||||
|
|
||||||
mem_HeapPrint( false);
|
mem_heap_print( false);
|
||||||
|
|
||||||
for ( uint32_t i = 0; i < test_iters; i++ )
|
for ( uint32_t i = 0; i < test_iters; i++ )
|
||||||
{
|
{
|
||||||
@ -58,7 +58,7 @@ main( int __unused argc,
|
|||||||
for ( uint32_t j = 0; j < subiters; j++ )
|
for ( uint32_t j = 0; j < subiters; j++ )
|
||||||
{
|
{
|
||||||
size_t size = (unsigned int) rand() % ( test_threshold_block_size );
|
size_t size = (unsigned int) rand() % ( test_threshold_block_size );
|
||||||
ptrs[j] = mem_HeapAllocBlock( size, ( rand() % 2 ) ? MEM_HEAP_ALLOC_SHORT_TERM : MEM_HEAP_ALLOC_SHORT_TERM);
|
ptrs[j] = mem_heap_alloc_block( size, ( rand() % 2 ) ? MEM_HEAP_ALLOC_SHORT_TERM : MEM_HEAP_ALLOC_SHORT_TERM);
|
||||||
sizes[j] = size;
|
sizes[j] = size;
|
||||||
if ( ptrs[j] != NULL )
|
if ( ptrs[j] != NULL )
|
||||||
{
|
{
|
||||||
@ -67,7 +67,7 @@ main( int __unused argc,
|
|||||||
// JERRY_ASSERT(ptrs[j] != NULL);
|
// JERRY_ASSERT(ptrs[j] != NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
// mem_HeapPrint( true);
|
// mem_heap_print( true);
|
||||||
|
|
||||||
for ( uint32_t j = 0; j < subiters; j++ )
|
for ( uint32_t j = 0; j < subiters; j++ )
|
||||||
{
|
{
|
||||||
@ -77,12 +77,12 @@ main( int __unused argc,
|
|||||||
{
|
{
|
||||||
JERRY_ASSERT( ptrs[j][k] == 0 );
|
JERRY_ASSERT( ptrs[j][k] == 0 );
|
||||||
}
|
}
|
||||||
mem_HeapFreeBlock( ptrs[j]);
|
mem_heap_free_block( ptrs[j]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mem_HeapPrint( false);
|
mem_heap_print( false);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
} /* main */
|
} /* main */
|
||||||
|
|||||||
@ -34,7 +34,7 @@ main( int __unused argc,
|
|||||||
getop_exitval( 0)
|
getop_exitval( 0)
|
||||||
};
|
};
|
||||||
|
|
||||||
mem_Init();
|
mem_init();
|
||||||
|
|
||||||
init_int( test_program);
|
init_int( test_program);
|
||||||
|
|
||||||
|
|||||||
@ -48,41 +48,41 @@ main( int __unused argc,
|
|||||||
|
|
||||||
for ( uint32_t i = 0; i < test_iters; i++ )
|
for ( uint32_t i = 0; i < test_iters; i++ )
|
||||||
{
|
{
|
||||||
mem_PoolState_t pool;
|
mem_pool_state_t pool;
|
||||||
uint8_t test_pool[test_pool_area_size] __attribute__((aligned(MEM_ALIGNMENT)));
|
uint8_t test_pool[test_pool_area_size] __attribute__((aligned(MEM_ALIGNMENT)));
|
||||||
|
|
||||||
const size_t chunkSize = MEM_ALIGNMENT * ( ( (size_t) rand() % test_max_chunk_size_divided_by_alignment ) + 1 );
|
const size_t chunk_size = MEM_ALIGNMENT * ( ( (size_t) rand() % test_max_chunk_size_divided_by_alignment ) + 1 );
|
||||||
|
|
||||||
mem_PoolInit( &pool, chunkSize, test_pool, sizeof (test_pool));
|
mem_pool_init( &pool, chunk_size, test_pool, sizeof (test_pool));
|
||||||
|
|
||||||
const size_t subiters = ( (size_t) rand() % test_max_sub_iters ) + 1;
|
const size_t subiters = ( (size_t) rand() % test_max_sub_iters ) + 1;
|
||||||
uint8_t* ptrs[subiters];
|
uint8_t* ptrs[subiters];
|
||||||
|
|
||||||
for ( size_t j = 0; j < subiters; j++ )
|
for ( size_t j = 0; j < subiters; j++ )
|
||||||
{
|
{
|
||||||
ptrs[j] = mem_PoolAllocChunk( &pool);
|
ptrs[j] = mem_pool_alloc_chunk( &pool);
|
||||||
|
|
||||||
// TODO: Enable check with condition that j <= minimum count of chunks that fit in the pool
|
// TODO: Enable check with condition that j <= minimum count of chunks that fit in the pool
|
||||||
// JERRY_ASSERT(ptrs[j] != NULL);
|
// JERRY_ASSERT(ptrs[j] != NULL);
|
||||||
|
|
||||||
if ( ptrs[j] != NULL )
|
if ( ptrs[j] != NULL )
|
||||||
{
|
{
|
||||||
memset(ptrs[j], 0, chunkSize);
|
memset(ptrs[j], 0, chunk_size);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// mem_HeapPrint( true);
|
// mem_heap_print( true);
|
||||||
|
|
||||||
for ( size_t j = 0; j < subiters; j++ )
|
for ( size_t j = 0; j < subiters; j++ )
|
||||||
{
|
{
|
||||||
if ( ptrs[j] != NULL )
|
if ( ptrs[j] != NULL )
|
||||||
{
|
{
|
||||||
for ( size_t k = 0; k < chunkSize; k++ )
|
for ( size_t k = 0; k < chunk_size; k++ )
|
||||||
{
|
{
|
||||||
JERRY_ASSERT( ((uint8_t*)ptrs[j])[k] == 0 );
|
JERRY_ASSERT( ((uint8_t*)ptrs[j])[k] == 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
mem_PoolFreeChunk( &pool, ptrs[j]);
|
mem_pool_free_chunk( &pool, ptrs[j]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -44,8 +44,8 @@ main( int __unused argc,
|
|||||||
{
|
{
|
||||||
uint8_t heap[test_heap_size] __attribute__((aligned(MEM_ALIGNMENT)));
|
uint8_t heap[test_heap_size] __attribute__((aligned(MEM_ALIGNMENT)));
|
||||||
|
|
||||||
mem_HeapInit( heap, sizeof (heap));
|
mem_heap_init( heap, sizeof (heap));
|
||||||
mem_PoolsInit();
|
mem_pools_init();
|
||||||
|
|
||||||
srand((unsigned int) time(NULL));
|
srand((unsigned int) time(NULL));
|
||||||
unsigned int seed = (unsigned int)rand();
|
unsigned int seed = (unsigned int)rand();
|
||||||
@ -57,49 +57,49 @@ main( int __unused argc,
|
|||||||
const size_t subiters = ( (size_t) rand() % test_max_sub_iters ) + 1;
|
const size_t subiters = ( (size_t) rand() % test_max_sub_iters ) + 1;
|
||||||
|
|
||||||
uint8_t * ptrs[subiters];
|
uint8_t * ptrs[subiters];
|
||||||
mem_PoolChunkType_t types[subiters];
|
mem_pool_chunk_type_t types[subiters];
|
||||||
|
|
||||||
for ( size_t j = 0; j < subiters; j++ )
|
for ( size_t j = 0; j < subiters; j++ )
|
||||||
{
|
{
|
||||||
mem_PoolChunkType_t type = (mem_PoolChunkType_t) (rand() % MEM_POOL_CHUNK_TYPE__COUNT);
|
mem_pool_chunk_type_t type = (mem_pool_chunk_type_t) (rand() % MEM_POOL_CHUNK_TYPE__COUNT);
|
||||||
const size_t chunkSize = mem_GetChunkSize( type);
|
const size_t chunk_size = mem_get_chunk_size( type);
|
||||||
|
|
||||||
types[j] = type;
|
types[j] = type;
|
||||||
ptrs[j] = mem_PoolsAlloc( type);
|
ptrs[j] = mem_pools_alloc( type);
|
||||||
JERRY_ASSERT(ptrs[j] != NULL);
|
JERRY_ASSERT(ptrs[j] != NULL);
|
||||||
|
|
||||||
if ( ptrs[j] != NULL )
|
if ( ptrs[j] != NULL )
|
||||||
{
|
{
|
||||||
__memset(ptrs[j], 0, chunkSize);
|
__memset(ptrs[j], 0, chunk_size);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// mem_HeapPrint( false);
|
// mem_heap_print( false);
|
||||||
|
|
||||||
for ( size_t j = 0; j < subiters; j++ )
|
for ( size_t j = 0; j < subiters; j++ )
|
||||||
{
|
{
|
||||||
if ( ptrs[j] != NULL )
|
if ( ptrs[j] != NULL )
|
||||||
{
|
{
|
||||||
mem_PoolChunkType_t type = types[j];
|
mem_pool_chunk_type_t type = types[j];
|
||||||
const size_t chunkSize = mem_GetChunkSize( type);
|
const size_t chunk_size = mem_get_chunk_size( type);
|
||||||
|
|
||||||
for ( size_t k = 0; k < chunkSize; k++ )
|
for ( size_t k = 0; k < chunk_size; k++ )
|
||||||
{
|
{
|
||||||
JERRY_ASSERT( ((uint8_t*) ptrs[j])[k] == 0 );
|
JERRY_ASSERT( ((uint8_t*) ptrs[j])[k] == 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
mem_PoolsFree( type, ptrs[j]);
|
mem_pools_free( type, ptrs[j]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef MEM_STATS
|
#ifdef MEM_STATS
|
||||||
mem_PoolsStats_t stats;
|
mem_pools_stats_t stats;
|
||||||
mem_PoolsGetStats( &stats);
|
mem_pools_get_stats( &stats);
|
||||||
#endif /* MEM_STATS */
|
#endif /* MEM_STATS */
|
||||||
|
|
||||||
__printf("Pools stats:\n");
|
__printf("Pools stats:\n");
|
||||||
for(mem_PoolChunkType_t type = 0;
|
for(mem_pool_chunk_type_t type = 0;
|
||||||
type < MEM_POOL_CHUNK_TYPE__COUNT;
|
type < MEM_POOL_CHUNK_TYPE__COUNT;
|
||||||
type++)
|
type++)
|
||||||
{
|
{
|
||||||
@ -109,7 +109,7 @@ main( int __unused argc,
|
|||||||
" Free chunks: %lu\n"
|
" Free chunks: %lu\n"
|
||||||
" Peak pools: %lu\n"
|
" Peak pools: %lu\n"
|
||||||
" Peak allocated chunks: %lu\n",
|
" Peak allocated chunks: %lu\n",
|
||||||
mem_GetChunkSize( type),
|
mem_get_chunk_size( type),
|
||||||
stats.pools_count[ type ],
|
stats.pools_count[ type ],
|
||||||
stats.allocated_chunks[ type ],
|
stats.allocated_chunks[ type ],
|
||||||
stats.free_chunks[ type ],
|
stats.free_chunks[ type ],
|
||||||
|
|||||||
@ -34,7 +34,7 @@ main( int __unused argc,
|
|||||||
getop_exitval( 0)
|
getop_exitval( 0)
|
||||||
};
|
};
|
||||||
|
|
||||||
mem_Init();
|
mem_init();
|
||||||
|
|
||||||
init_int( test_program);
|
init_int( test_program);
|
||||||
|
|
||||||
|
|||||||
@ -34,7 +34,7 @@ main( int __unused argc,
|
|||||||
getop_exitval( 0)
|
getop_exitval( 0)
|
||||||
};
|
};
|
||||||
|
|
||||||
mem_Init();
|
mem_init();
|
||||||
|
|
||||||
init_int( test_program);
|
init_int( test_program);
|
||||||
|
|
||||||
|
|||||||
@ -30,7 +30,7 @@ main( int __unused argc,
|
|||||||
getop_exitval( 0)
|
getop_exitval( 0)
|
||||||
};
|
};
|
||||||
|
|
||||||
mem_Init();
|
mem_init();
|
||||||
|
|
||||||
init_int( test_program);
|
init_int( test_program);
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user