#include <iostream>#include <fstream>#include <string>#include <string.h>#include <stdio.h>#include <unistd.h>#include "Logger.h"#include "readline.h"#include "OverviewFmt.h"#include "Article.h"Go to the source code of this file.
Functions | |
| int | checkConvertOverOver () |
| int | checkConvertArtOver (const char *artfn) |
| int | main (int argc, char *argv[]) |
Variables | |
| char * | articleList [] = { "article5283", "article9621", "article9622" } |
| Logger | slog |
|
|
Definition at line 64 of file cOverviewFmt.cc. References OverviewFmt::convert(), nlreadline(), Article::read(), and Article::setnbr(). Referenced by main().
00065 {
00066 char buf[256];
00067 ifstream is;
00068 Article art;
00069 OverviewFmt o;
00070 string orec1, orec2;
00071
00072 sprintf(buf, "%s.in", artfn);
00073 is.open(buf);
00074 art.read(is);
00075 is.close();
00076
00077 sprintf(buf, "%s.over.in", artfn);
00078 is.open(buf);
00079 nlreadline(is, orec2, 0);
00080 is.close();
00081
00082 art.setnbr(atoi(orec2.c_str()));
00083 o.convert(art, orec1);
00084
00085 if (strcmp(orec1.c_str(), orec2.c_str())) {
00086 cout << "checkConvertArtOver:\n";
00087 cout << " Got[" << orec1.
00088 length() << "]: " << orec1 << endl;
00089 cout << " SBe[" << orec1.
00090 length() << "]: " << orec2 << endl;
00091 return -11;
00092 }
00093 return 0;
00094 }
|
|
|
Definition at line 20 of file cOverviewFmt.cc. References OverviewFmt::convert(), nlreadline(), and OverviewFmt::readxoin(). Referenced by main().
00021 {
00022 int err = 0;
00023 ifstream is;
00024 OverviewFmt o1, o2;
00025 string orec1, orec2, orec3;
00026
00027 is.open("overviewfmt1.in");
00028 o1.readxoin(is);
00029 is.close();
00030
00031 is.open("overviewfmt2.in");
00032 o2.readxoin(is);
00033 is.close();
00034
00035 is.open("overviewdb.in");
00036 for (;;) {
00037 nlreadline(is, orec1, 0);
00038 if (!is.good())
00039 break;
00040 o1.convert(orec1, orec2);
00041 if (strcmp(orec1.c_str(), orec2.c_str())) {
00042 cout << "checkConvertOverOver: check 1 failed\n";
00043 cout << " RecordIn: " << orec1 << endl;
00044 cout << " RecordOut: " << orec2 << endl;
00045 err = 1;
00046 }
00047 // o2.convert(orec1,orec2);
00048 // o1.convert(orec2,orec3);
00049 // if(strcmp(orec1.c_str(),orec3.c_str())) {
00050 // cerr << "checkConvertOverOver: check 2 failed\n";
00051 // cerr << " RecordIn: " << orec1 << endl;
00052 // cerr << " RecordTmp: " << orec2 << endl;
00053 // cerr << " RecordOut: " << orec3 << endl;
00054 // err=1;
00055 // }
00056 }
00057 is.close();
00058
00059 if (err)
00060 return -1;
00061 return 0;
00062 }
|
|
||||||||||||
|
Definition at line 96 of file cOverviewFmt.cc. References articleList, checkConvertArtOver(), checkConvertOverOver(), and ef.
00097 {
00098 char **al = articleList;
00099 int e, ef = 0, i, j = sizeof(articleList) / sizeof(articleList[0]);
00100
00101 chdir(getenv("srcdir"));
00102 if (argc > 1) {
00103 al = argv + 1;
00104 j = argc - 1;
00105 }
00106
00107 cout << "cOverviewFmt:\n";
00108 for (i = 0; i < j; i++) {
00109 if ((e = checkConvertArtOver(al[i])) < 0) {
00110 cout << "checkConvertArtOver(" << al[i] <<
00111 ") failed with: " << e << endl;
00112 ef++;
00113 } else {
00114 cout << "checkConvertArtOver(" << al[i] <<
00115 ") succeeded\n";
00116 }
00117 }
00118 if ((e = checkConvertOverOver()) < 0) {
00119 cout << "checkConvertOverOver failed with: " << e << endl;
00120 ef++;
00121 } else {
00122 cout << "checkConvertOverOver succeeded\n";
00123 }
00124
00125 if (ef == 0) {
00126 cout << "cOverviewFmt: all tests succeeded\n";
00127 exit(0);
00128 } else {
00129 cout << "cOverviewFmt: " << ef << " failures\n";
00130 exit(-1);
00131 }
00132 }
|
|
|
Definition at line 16 of file cOverviewFmt.cc. |
|
|
Definition at line 18 of file cOverviewFmt.cc. |
1.3.6-20040222