void check_OUTCAR_Read() { int i; FILE *pf= NULL; if ((pf=fopen("data/outcar/OUTCAR","r"))==NULL) g_assert(false); OUTCAR* out= OUTCAR_New(); OUTCAR_Read(out, pf); LIST* list_e_fermi= OUTCAR_Get(out, "E-fermi"); double *d= LIST_Get(list_e_fermi, 0); g_assert_cmpfloat(*d, ==, 1.5917 ); LIST* list_str_list= OUTCAR_Get(out, "TITEL"); for (i=0; i<2; i++) { LIST* str_list= LIST_Get(list_str_list, i); char* ex= LIST_Get(str_list, 0); char* elem= LIST_Get(str_list, 1); char* date= LIST_Get(str_list, 2); if (i==0) { g_assert_cmpstr(ex, ==, "PAW_PBE"); g_assert_cmpstr(elem, ==, "Pb"); g_assert_cmpstr(date, ==, "08Apr2002"); } else if (i==1)
void check_INCAR_Read() { FILE* pf= NULL; KEYWORD* keyword; if ((pf=fopen("data/keyword/KEYWORD","r"))==NULL) g_assert(false); keyword= KEYWORD_New(); KEYWORD_Read(keyword, pf); fclose(pf); if ((pf=fopen("data/incar/INCAR","r"))==NULL) g_assert(false); INCAR* incar= INCAR_New(); INCAR_Read(incar, keyword, pf); fclose(pf); char* s= INCAR_Get(incar, "SYSTEM"); g_assert_cmpstr(s,==,"TEST"); bool* b= INCAR_Get(incar, "LVTOT"); g_assert((*b)==false); int* i= INCAR_Get(incar, "ISTART"); g_assert_cmpint(*i,==, 0); double* d= INCAR_Get(incar, "EDIFF"); g_assert_cmpfloat(*d ,==, 1E-4); LIST* list_b= INCAR_Get(incar, "LRCTYPE"); b= LIST_Get(list_b, 0); g_assert((*b)==true); b= LIST_Get(list_b, 1); g_assert((*b)==false); b= LIST_Get(list_b, 2); g_assert((*b)==false); b= LIST_Get(list_b, 3); g_assert((*b)==false); b= LIST_Get(list_b, 4); g_assert((*b)==true); LIST* list_i= INCAR_Get(incar, "NSUBSYS"); i= LIST_Get(list_i, 0); g_assert_cmpint(*i, ==, 1); i= LIST_Get(list_i, 1); g_assert_cmpint(*i, ==, 2); i= LIST_Get(list_i, 2); g_assert_cmpint(*i, ==, 3); i= LIST_Get(list_i, 3); g_assert_cmpint(*i, ==, 4); i= LIST_Get(list_i, 4); g_assert_cmpint(*i, ==, 5); LIST* list_d= INCAR_Get(incar, "RWIGS"); d= LIST_Get(list_d, 0); g_assert_cmpfloat(*d, ==, .01); d= LIST_Get(list_d, 1); g_assert_cmpfloat(*d, ==, 2E-1); d= LIST_Get(list_d, 2); g_assert_cmpfloat(*d, ==, 3); d= LIST_Get(list_d, 3); g_assert_cmpfloat(*d, ==, -40.); d= LIST_Get(list_d, 4); g_assert_cmpfloat(*d, ==, -5E3); d= LIST_Get(list_d, 5); g_assert_cmpfloat(*d, ==, -60000.00); KEYWORD_Free(keyword); INCAR_Free(incar); }