#include "config.h" #include #include #include #include #include "asmsh_check.h" #include "completion.h" const char *icompl_a[] = {"a", "aaa", "aad", "aam", "aas", "adc", "add", "and", "andn", NULL}; const char *icompl_x[] = {"x", "xadd", "xchg", "xlat", "xor", NULL}; const char *icompl_j[] = {"j", "jo", "jno", "jb", "jc", "jnae", "jae", "jnb", "jnc", "je", "jz", "jne", "jnz", "jbe", "jna", "ja", "jnbe", "js", "jns", "jp", "jpe", "jnp", "jpo", "jl", "jnge", "jge", "jnl", "jle", "jng", "jg", "jnle", "jmp", NULL}; const char *icompl_xa[] = {"xr", NULL}; const char *icompl_ro[] = {"ro", "rol", "ror", NULL}; const char *icompl_movs[] = {"movs", "movs", "movsb", "movsw", "movsd", "movsq", "movsx", NULL}; const char *icompl_movb[] = {"movb", "movb", "movbe", NULL}; const char **icompl[] = {icompl_a, icompl_x, icompl_j, icompl_xa, icompl_ro, icompl_movs, icompl_movb}; int icompl_sz = sizeof(icompl)/sizeof(*icompl); START_TEST(test_instr_completions) { const char **curcomp = icompl[_i]; char **ret; int i; ret = asmsh_compl_instr(curcomp[0]); ck_assert_ptr_nonnull(ret); i=0; while(1) { if(!ret[i] || !curcomp[i+1]) { ck_assert_ptr_null(ret[i]); ck_assert_ptr_null(curcomp[i+1]); break; } ck_assert_str_eq(ret[i], curcomp[i+1]); free(ret[i]); i++; } free(ret); } END_TEST ASMSH_CHECK_START("testing completion", "Testing completion features") ASMSH_ADD_LOOP_TEST(test_instr_completions, 0, icompl_sz); ASMSH_CHECK_END