From 151d278a48b436fd815e75f89810ae754a911f02 Mon Sep 17 00:00:00 2001 From: Harry Moffat Date: Sat, 20 Dec 2003 17:53:23 +0000 Subject: [PATCH] Fixed 2 things: stripped column names checked for zero title lines --- tools/testtools/csvdiff.cpp | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/tools/testtools/csvdiff.cpp b/tools/testtools/csvdiff.cpp index fe35cc6e7..f0f329b27 100644 --- a/tools/testtools/csvdiff.cpp +++ b/tools/testtools/csvdiff.cpp @@ -370,6 +370,7 @@ read_colTitle(FILE *fp, char ****ColMLNames_ptr, int nColTitleLines, int nCol) int ncolsFound = breakStrCommas(scanLine, strlets, nCol); ColMLNames[i] = mdp_alloc_VecFixedStrings(nCol, MAX_TOKEN_STR_LN+1); for (j = 0; j < ncolsFound; j++) { + strip(strlets[j]); strcpy(ColMLNames[i][j], strlets[j]); } } @@ -596,10 +597,23 @@ int main(int argc, char *argv[]) read_title(fp1, &title1, nTitleLines1); read_title(fp2, &title2, nTitleLines2); - if (strcmp(title1[0], title2[0]) != 0) { - printf("Titles differ:\n\t\"%s\"\n\t\"%s\"\n", title1[0], title2[0]); - } else if (Debug_Flag) { - printf("Title for each file: \"%s\"\n", title1[0]); + if (nTitleLines1 > 0 && nTitleLines2 > 0) { + if (strcmp(title1[0], title2[0]) != 0) { + printf("Titles differ:\n\t\"%s\"\n\t\"%s\"\n", title1[0], title2[0]); + } else if (Debug_Flag) { + printf("Title for each file: \"%s\"\n", title1[0]); + } + } else { + if (nTitleLines1 != nTitleLines2) { + if (nTitleLines1) { + printf("Titles differ: title for first file: \"%s\"\n", + title1[0]); + } + if (nTitleLines2) { + printf("Titles differ: title for second file: \"%s\"\n", + title2[0]); + } + } } /*