/*****************************************************************************/ /* main.c - test frame for align.c /*****************************************************************************/ #include "score.h" typedef struct { char *pszA; char *pszB; } Test; Payoff gPayoff = { 1, -1, -1, -1 }; Test gTests[] = { { "abcde", "abcde" }, { "abcdefgh", "abcxefgh" }, { "abcdefgh", "bcdefghi" }, { "abcdefghijklmnopqrst", "abcdijklqrst" }, { "cgatcaaacaaccgat", "cgatcaaccgat" }, { 0 } }; static void AlignString(char *pszA, char *pszB, Payoff payoff); static void StringTests(); static void TimeTest(); static char *RandString (int n); extern int main() { StringTests(); TimeTest(); return 0; } void StringTests() { int i; for (i=0; gTests[i].pszA; i++) AlignString(gTests[i].pszA, gTests[i].pszB, gPayoff); } void AlignString(char *pszA, char *pszB, Payoff payoff) { Matrix *pMatrix = New(pszA, pszB, payoff); Score(pMatrix); DumpScore(pMatrix); Delete(pMatrix); } void TimeTest() { char *pszA = RandString(200); char *pszB = RandString(200); int start, end; Matrix *pMatrix; start = time(0); pMatrix = New(pszA, pszB, gPayoff); Score(pMatrix); Delete(pMatrix); end = time(0); printf("%d seconds\n", end-start); } char *RandString(int n) { char *psz = (char *) malloc(n+1); int i; for (i=0; i