END_TEST START_TEST(insert_job_after_test) { struct all_jobs alljobs; struct job *test_job; int result; initialize_all_jobs_array(&alljobs); test_job = job_alloc(); result = insert_job_after(NULL,test_job,test_job); fail_unless(result != PBSE_NONE, "insert into null array fail"); result = insert_job_after(&alljobs,NULL,test_job); fail_unless(result != PBSE_NONE, "NULL job after insert fail"); result = insert_job_after(&alljobs,test_job,NULL); fail_unless(result != PBSE_NONE, "NULL job to insert fail"); insert_job(&alljobs,test_job); result = insert_job_after(&alljobs,test_job,test_job); fail_unless(result == PBSE_NONE, "job insert fail"); }
END_TEST START_TEST(insert_job_after_test) { all_jobs alljobs; struct job *test_job; int result; test_job = job_alloc(); strcpy(test_job->ji_qs.ji_jobid,"mylittlejob"); result = insert_job_after(NULL,test_job,test_job); fail_unless(result != PBSE_NONE, "insert into null array fail"); result = insert_job_after(&alljobs,(char *)NULL,test_job); fail_unless(result != PBSE_NONE, "NULL job after insert fail"); result = insert_job_after(&alljobs,test_job,NULL); fail_unless(result != PBSE_NONE, "NULL job to insert fail"); insert_job(&alljobs,test_job); result = insert_job_after(&alljobs,test_job,test_job); fail_unless(result == PBSE_NONE, "job insert fail"); }
END_TEST START_TEST(swap_jobs_test) { struct all_jobs alljobs; struct job *test_job; struct job *second_test_job; int result; initialize_all_jobs_array(&alljobs); test_job = job_alloc(); second_test_job = job_alloc(); result = swap_jobs(&alljobs,NULL,test_job); fail_unless(result != PBSE_NONE, "NULL first input job fail"); result = insert_job_after(&alljobs,test_job,NULL); fail_unless(result != PBSE_NONE, "NULL second input job fail"); insert_job(&alljobs, test_job); insert_job(&alljobs, second_test_job); result = swap_jobs(&alljobs, test_job,second_test_job); fail_unless(result == PBSE_NONE, "swap jobs fail"); }
END_TEST START_TEST(swap_jobs_test) { all_jobs alljobs; struct job *test_job; struct job *second_test_job; int result; test_job = job_alloc(); second_test_job = job_alloc(); strcpy(test_job->ji_qs.ji_jobid,"test"); strcpy(second_test_job->ji_qs.ji_jobid,"second_test"); result = swap_jobs(&alljobs,NULL,test_job); fail_unless(result != PBSE_NONE, "NULL first input job fail"); result = insert_job_after(&alljobs,test_job,NULL); fail_unless(result != PBSE_NONE, "NULL second input job fail"); insert_job(&alljobs, test_job); insert_job(&alljobs, second_test_job); result = swap_jobs(&alljobs, test_job,second_test_job); fail_unless(result == PBSE_NONE, "swap jobs fail"); }