diff options
author | John Ankarström <john@ankarstrom.se> | 2022-08-17 19:01:26 +0200 |
---|---|---|
committer | John Ankarström <john@ankarstrom.se> | 2022-08-17 19:01:26 +0200 |
commit | 78fbe9fcba52cad4b4c36aca7c385b3a8f45824a (patch) | |
tree | 63c1c602fc76ec33bc1751efaea685946daee5fe /c/test.cpp | |
parent | 853a598befbb8823c5868c792f51cda3466fada1 (diff) | |
download | EpisodeBrowser-78fbe9fcba52cad4b4c36aca7c385b3a8f45824a.tar.gz |
DataListView: Use file view.
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)); |