diff options
Diffstat (limited to 'c/test.cpp')
-rw-r--r-- | c/test.cpp | 33 |
1 files changed, 31 insertions, 2 deletions
@@ -4,6 +4,8 @@ #include "util.h" #include "win.h" +extern CfgA& g_cfg; + struct Test { const char* name = {0}; @@ -115,7 +117,7 @@ TESTS return; { - FileView<ElvDataA> fv{L"tmp.dat", ELVMAX}; + FileView<ElvDataA> fv{L"tmp.dat", g_cfg.cEp+128u}; ElvDataA* p = fv; for (int iEp = 1; iEp <= cEp; iEp++) { @@ -126,7 +128,7 @@ TESTS } } { - FileView<ElvDataA> fv{L"tmp.dat", 8192}; + FileView<ElvDataA> fv{L"tmp.dat", g_cfg.cEp+128u}; ElvDataA& e = fv.At(9); if (wcscmp(e.title, L"Pro Soccer Player Blackmail Case") != 0) FAIL("title is not correct"); @@ -167,6 +169,32 @@ TESTS // Wcscpy(fvb->glob, fva->glob); // Wcscpy(fvb->url, fva->url); // } + + TEST(MigrateDlvDataFromPrologToDisk) + { + int cEp; + if (!Pl("episode_data","episode_count",&cEp)) + return; + + { + FileView<DlvDataA> fv{L"tmp.dat", g_cfg.cEp+128u}; + DlvDataA* p = fv; + + for (int iEp = 1; iEp <= cEp; iEp++) { + DlvDataA d; + FromProlog(iEp, d); + memcpy(p, &d, sizeof(d)); + p++; + } + } + { + FileView<DlvDataA> fv{L"tmp.dat", g_cfg.cEp+128u}; + DlvDataA& e = fv.At(9); + if (wcscmp(e.date, L"March 11, 1996") != 0) + FAIL("date is not correct"); + } + //DeleteFile(L"tmp.dat"); + } }; int RunTests() @@ -179,6 +207,7 @@ int RunTests() //MigrateElvDataFromPrologToDisk{}, SampleConfigurationToDisk{}, //MigrateCfg{} + MigrateDlvDataFromPrologToDisk{}, }; printf("Results (%llu tests):\n", sizeof(tests)/sizeof(*tests)); |