Beispiel #1
0
void
test_list_move_to_last_to_first(
		)
{
	list_type *list;
	TEST_INIT("list_move_to (last -> first)", "gtestin");
	list = create_testing();

	list = list_move_to(list, NULL, list);
	TEST_FINISH(list);
}
Beispiel #2
0
void *root_thread(void *cookie)
{
    TEST_START(0);

    TEST_CHECK_SEQUENCE(SEQ("root", 1),
                        END_SEQ);

    TEST_FINISH();

    return NULL;
}
Beispiel #3
0
void
test_list_delete_first(
		)
{
	list_type *list;
	TEST_INIT("list_delete (first)", "ting");
	list = create_testing();

	list = list_delete(list, list);
	list = list_delete(list, list);
	list = list_delete(list, list);
	TEST_FINISH(list);
}
Beispiel #4
0
void
test_list_move_to_first_to(
		)
{
	list_type *list;
	list_type *ptr;
	TEST_INIT("list_move_to (-> first)", "ntestig");
	list = create_testing();

	ptr = list_find(list, (void *) 'n');
	list = list_move_to(list, ptr, list);
	TEST_FINISH(list);
}
Beispiel #5
0
void
test_list_move_to_last_from(
		)
{
	list_type *list;
	list_type *ptr;
	TEST_INIT("list_move_to (last ->)", "tegstin");
	list = create_testing();

	ptr = list_find(list, (void *) 's');
	list = list_move_to(list, NULL, ptr);
	TEST_FINISH(list);
}
Beispiel #6
0
void
test_list_insert_at_last(
		)
{
	list_type *list;
	TEST_INIT("list_insert_at (first)", "testingXXX");
	list = create_testing();

	list = list_insert_at(list, NULL, (void *) 'X');
	list = list_insert_at(list, NULL, (void *) 'X');
	list = list_insert_at(list, NULL, (void *) 'X');
	TEST_FINISH(list);
}
Beispiel #7
0
void
test_list_move_to_first_from(
		)
{
	list_type *list;
	list_type *ptr;
	TEST_INIT("list_move_to (first ->)", "estitng");
	list = create_testing();

	ptr = list_find(list, (void *) 'n');
	list =llist_move_to(list, list, ptr);
	TEST_FINISH(list);
}
Beispiel #8
0
void
test_list_move_to_last_to(
		)
{
	list_type *list;
	list_type *ptr;
	TEST_INIT("list_move_to (-> last)", "testign");
	list = create_testing();

	ptr = list_find(list, (void *) 'n');
	list = list_move_to(list, ptr, NULL);
	TEST_FINISH(list);
}
Beispiel #9
0
void
test_list_insert_at_first(
		)
{
	list_type *list;
	TEST_INIT("list_insert_at (first)", "XXXtesting");
	list = create_testing();

	list = list_insert_at(list, list, (void *) 'X');
	list = list_insert_at(list, list, (void *) 'X');
	list = list_insert_at(list, list, (void *) 'X');
	TEST_FINISH(list);
}
Beispiel #10
0
void
test_list_delete_last(
		)
{
	list_type *list;
	TEST_INIT("list_delete (last)", "test");
	list = create_testing();

	list = list_delete(list, list->last);
	list = list_delete(list, list->last);
	list = list_delete(list, list->last);
	TEST_FINISH(list);
}
Beispiel #11
0
void
test_list_move_first_to_first(
		)
{
	list_type *list;
	
	TEST_INIT("list_move_first_to (first)", "testing");
	list = create_testing();

	list = list_move_first_to(list, list);
	list = list_move_first_to(list, list);
	list = list_move_first_to(list, list);
	TEST_FINISH(list);
}
Beispiel #12
0
void
test_list_move_to_middle(
		)
{
	list_type *list;
	list_type *ptr0, *ptr1;
	TEST_INIT("list_move_to (middle)", "tenstig");
	list = create_testing();

	ptr0 = list_find(list, (void *) 'n');
	ptr1 = list_find(list, (void *) 's');
	list = list_move_to(list, ptr0, ptr1);
	TEST_FINISH(list);
}
Beispiel #13
0
void
test_list_add_head(
		)
{
	list_type *list;
	TEST_INIT("list_add_head", "testing");

	list = NULL;
	list = list_add_head(list, (void *) 'g'); DUMP_POINTERS(list);
	list = list_add_head(list, (void *) 'n'); DUMP_POINTERS(list);
	list = list_add_head(list, (void *) 'i'); DUMP_POINTERS(list);
	list = list_add_head(list, (void *) 't'); DUMP_POINTERS(list);
	list = list_add_head(list, (void *) 's'); DUMP_POINTERS(list);
	list = list_add_head(list, (void *) 'e'); DUMP_POINTERS(list);
	list = list_add_head(list, (void *) 't'); DUMP_POINTERS(list);
	TEST_FINISH(list);
}
Beispiel #14
0
void
test_list_insert_at_middle(
		)
{
	list_type *list;
	list_type *ptr;
	TEST_INIT("list_insert_at (middle)", "teXstXiXng");
	list = create_testing();

	ptr = list_find(list, (void *) 'i');
	list = list_insert_at(list, ptr, (void *) 'X');
	ptr = list_find(list, (void *) 's');
	list = list_insert_at(list, ptr, (void *) 'X');
	ptr = list_find(list, (void *) 'n');
	list = list_insert_at(list, ptr, (void *) 'X');
	TEST_FINISH(list);
}
Beispiel #15
0
void
test_list_delete_middle(
		)
{
	list_type *list;
	list_type *ptr;
	TEST_INIT("list_delete (middle)", "tstg");
	list = create_testing();

	ptr = list_find(list, (void *) 'i');
	list = list_delete(list, ptr);
	ptr = list_find(list, (void *) 'e');
	list = list_delete(list, ptr);
	ptr = list_find(list, (void *) 'n');
	list = list_delete(list, ptr);
	TEST_FINISH(list);
}
Beispiel #16
0
void
test_list_move_first_to_middle(
		)
{
	list_type *list;
	list_type *ptr;
	
	TEST_INIT("list_move_first_to (middle)", "tsitneg");
/*	TEST_INIT("list_move_first_to (middle)", "estitng"); */
	list = create_testing();

	ptr = list_find(list, (void *) 'n');
	list = list_move_first_to(list, ptr);
printf("%s", list_dump(list));
	ptr = list_find(list, (void *) 'g');
	list = list_move_first_to(list, ptr);
printf("%s", list_dump(list));
	ptr = list_find(list, (void *) 'i');
	list = list_move_first_to(list, ptr);
printf("%s", list_dump(list));
	TEST_FINISH(list);
}
Beispiel #17
0
int main(int argc, char *argv[])
{
    if (AFAILED(app_init("tsl_tests"))) {
        PANIC("Failed to perform basic application initialization process.");
    }

    TEST_START(tsl);
    TEST_CASE(test_alloc_basic);
    TEST_CASE(test_refcnt_basic);
    TEST_CASE(test_rbtree_lifecycle);
    TEST_CASE(test_rbtree_corner_cases);
    TEST_CASE(test_cpu_mask);
    TEST_CASE(test_time);
    TEST_CASE(test_speed);
    TEST_CASE(test_fixed_heap);
    TEST_CASE(test_queue);
    TEST_CASE(test_work_endpoint);
    TEST_CASE(test_work_thread);
    TEST_CASE(test_work_pool);
    TEST_FINISH(tsl);
    return EXIT_SUCCESS;
}
Beispiel #18
0
void rootTask (long a0, long a1, long a2, long a3, long a4,
	       long a5, long a6, long a7, long a8, long a9)
{
    WIND_TCB *pTcb;

    TEST_START(0);

    pTcb = taskTcb(taskIdSelf());
    TEST_ASSERT(pTcb != NULL);

    bsemid = semBCreate(0xffffffff,0);
    TEST_ASSERT(bsemid == 0 && errno == S_semLib_INVALID_QUEUE_TYPE);

    bsemid = semBCreate(SEM_Q_PRIORITY,0);
    TEST_ASSERT(bsemid != 0);

    mutexid = semMCreate(0xffffffff);
    TEST_ASSERT(mutexid == 0 && errno == S_semLib_INVALID_QUEUE_TYPE);

    mutexid = semMCreate(SEM_Q_PRIORITY|SEM_DELETE_SAFE|SEM_INVERSION_SAFE);
    TEST_ASSERT(mutexid != 0);

    taskSpawn("Test1",
	      20,		/* low-pri */
	      0,
	      32768,
	      sem1Task,
	      taskIdSelf(),0,0,0,0,0,0,0,0,0);

    taskSpawn("Test2",
	      10,		/* intermediate-pri */
	      0,
	      32768,
	      sem2Task,
	      taskIdSelf(),0,0,0,0,0,0,0,0,0);

    /* This runs at high-pri */

    TEST_MARK();

    TEST_ASSERT_OK(semTake(bsemid,WAIT_FOREVER));

    TEST_MARK();

    TEST_ASSERT_OK(taskSuspend(0));

    TEST_MARK();

    TEST_ASSERT_OK(semTake(mutexid,WAIT_FOREVER));

    TEST_MARK();

    TEST_ASSERT_OK(semGive(mutexid));

    TEST_MARK();

    TEST_ASSERT(taskIsReady(taskNameToId("Test2")));

    TEST_ASSERT(!taskIsSuspended(taskNameToId("Test2")));

    TEST_ASSERT_OK(taskDelay(1));

    TEST_MARK();

    TEST_CHECK_SEQUENCE(SEQ("root",1),
			SEQ("Test2",1),
			SEQ("root",1),
			SEQ("Test2",1),
			SEQ("Test1",2),
			SEQ("Test2",1),
			SEQ("root",1),
			SEQ("Test1",1),
			SEQ("root",2),
			SEQ("Test2",1),
			SEQ("root",1),
			END_SEQ);
    TEST_FINISH();
}