Example #1
0
void test_reader_list_isNotEmpty(){
	reader_list_initialize();
	reader_t* reader_ritardo5_bufferUnitario=reader_initialize("Reader 2",5,1);
	reader_list_addReader((void*)reader_ritardo5_bufferUnitario);
	CU_ASSERT_FALSE(reader_list_isEmpty());
	reader_destroy(reader_ritardo5_bufferUnitario);
	reader_list_destroy();
}
Example #2
0
void test_reader_list_broadcast(){
	reader_list_initialize();
	reader_t* reader_ritardoUnitario_bufferGenerico=reader_initialize("Reader 1",1,10);
	reader_t* reader_ritardo5_bufferGenerico=reader_initialize("Reader 2", 5,2);
	add_twoReaders(reader_ritardoUnitario_bufferGenerico,reader_ritardo5_bufferGenerico);
	reader_list_broadcast(messaggio);
	ASSERT_BUFFER_CONTAINS_ONLY(reader_ritardoUnitario_bufferGenerico->buffer->read_buffer, messaggio);
	ASSERT_BUFFER_CONTAINS_ONLY(reader_ritardo5_bufferGenerico->buffer->read_buffer, messaggio);
	clean_buffer_reader(reader_ritardoUnitario_bufferGenerico, reader_ritardo5_bufferGenerico);
	remove_twoReaders(reader_ritardoUnitario_bufferGenerico,reader_ritardo5_bufferGenerico);
	reader_list_destroy();	
}
Example #3
0
void test_reader_list_kill(){
	reader_list_initialize();
	reader_t* reader_ritardoUnitario_bufferGenerico=reader_initialize("Reader 1",1,10);
	reader_t* reader_ritardo5_bufferUnitario=reader_initialize("Reader 2",5,1);
	add_twoReaders(reader_ritardoUnitario_bufferGenerico,reader_ritardo5_bufferUnitario);
	reader_list_kill();
	ASSERT_BUFFER_CONTAINS_ONLY(reader_ritardoUnitario_bufferGenerico->buffer->read_buffer, (msg_t*)&POISON_PILL_MSG);
	ASSERT_BUFFER_CONTAINS_ONLY(reader_ritardo5_bufferUnitario->buffer->read_buffer, (msg_t*)&POISON_PILL_MSG);
	clean_buffer_reader(reader_ritardoUnitario_bufferGenerico, reader_ritardo5_bufferUnitario);
	remove_twoReaders(reader_ritardoUnitario_bufferGenerico,reader_ritardo5_bufferUnitario);
	reader_list_destroy();	
}
Example #4
0
void test_reader_list_addOneReader(){
	reader_list_initialize();
	reader_t* reader_ritardoUnitario_bufferGenerico=reader_initialize("Reader 1",1,10);
	CU_ASSERT_EQUAL(reader_list_size(),0);
	reader_list_addReader((void*)reader_ritardoUnitario_bufferGenerico);
	CU_ASSERT_PTR_NOT_NULL(reader_list->head);
	CU_ASSERT_PTR_NOT_NULL(reader_list->tail);
	CU_ASSERT_PTR_EQUAL(reader_list->head, reader_list->tail);
	CU_ASSERT_EQUAL(reader_list_size(),1);
	reader_destroy(reader_ritardoUnitario_bufferGenerico);
	reader_list_destroy();
}
Example #5
0
void test_reader_list_addTwoReaders(){
	reader_list_initialize();
	CU_ASSERT_EQUAL(reader_list_size(),0);
	reader_t* reader_ritardoUnitario_bufferGenerico=reader_initialize("Reader 1",1,10);
	reader_t* reader_ritardo5_bufferUnitario=reader_initialize("Reader 2",5,1);
	add_twoReaders(reader_ritardoUnitario_bufferGenerico,reader_ritardo5_bufferUnitario);
	CU_ASSERT_PTR_NOT_NULL(reader_list->head);
	CU_ASSERT_PTR_NOT_NULL(reader_list->tail);
	CU_ASSERT_PTR_NOT_EQUAL(reader_list->head, reader_list->tail);
	CU_ASSERT_PTR_EQUAL(reader_list->head->next, reader_list->tail);
	CU_ASSERT_EQUAL(reader_list_size(),2);
	remove_twoReaders(reader_ritardoUnitario_bufferGenerico,reader_ritardo5_bufferUnitario);
	reader_list_destroy();
}
Example #6
0
void test_reader_list_isEmpty(){
	reader_list_initialize();
	CU_ASSERT_TRUE(reader_list_isEmpty());
	reader_list_destroy();
}
int reader_after2() {
    reader_destroy(reader_ritardoUnitario_bufferGenerico);
    reader_list_destroy();
    return 0;
}
int dispatcher_after(){
	provider_buffer_destroy();
	reader_list_destroy();
	return 0;
}