From 78fbe9fcba52cad4b4c36aca7c385b3a8f45824a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20Ankarstr=C3=B6m?= Date: Wed, 17 Aug 2022 19:01:26 +0200 Subject: DataListView: Use file view. --- c/test.cpp | 33 +++++++++++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) (limited to 'c/test.cpp') diff --git a/c/test.cpp b/c/test.cpp index 92644ba..1054978 100644 --- a/c/test.cpp +++ b/c/test.cpp @@ -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 fv{L"tmp.dat", ELVMAX}; + FileView fv{L"tmp.dat", g_cfg.cEp+128u}; ElvDataA* p = fv; for (int iEp = 1; iEp <= cEp; iEp++) { @@ -126,7 +128,7 @@ TESTS } } { - FileView fv{L"tmp.dat", 8192}; + FileView 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 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 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)); -- cgit v1.2.3