From ee1eafe1ed12c2c46ed31ad560daeae11ab1e027 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20Ankarstr=C3=B6m?= Date: Mon, 22 Aug 2022 13:00:06 +0200 Subject: Clean up tests. --- c/test.cpp | 116 +++++++++++++------------------------------------------------ 1 file changed, 24 insertions(+), 92 deletions(-) (limited to 'c/test.cpp') diff --git a/c/test.cpp b/c/test.cpp index a649f23..2e96bbc 100644 --- a/c/test.cpp +++ b/c/test.cpp @@ -33,29 +33,6 @@ TESTS FAIL("dst is not NUL-terminated"); } - TEST(EpisodeDataFromWeb) - { - ElvDataA e; - DlvDataA d; - FromWeb(10, e, d); - if (wcscmp(e.title, L"Pro Soccer Player Blackmail Case") != 0) - FAIL("title is not correct"); - if (wcscmp(d.date, L"March 11, 1996") != 0) - FAIL("date is not correct"); - } - - TEST(EpisodeDataFromProlog) - { - ElvDataA e; - DlvDataA d; - FromProlog(10, e); - FromProlog(10, d); - if (wcscmp(e.title, L"Pro Soccer Player Blackmail Case") != 0) - FAIL("title is not correct"); - if (wcscmp(d.date, L"March 11, 1996") != 0) - FAIL("date is not correct"); - } - TEST(IO) { ElvDataA e1_0, e2_0; @@ -137,40 +114,6 @@ TESTS //DeleteFile(L"tmp.dat"); } - TEST(SampleConfigurationToDisk) - { - CfgA cfg_0; - { - FileView fv(L"tmp.dat", 1); - Wcscpy(cfg_0.url, L"https://animixplay.to/v1/detective-conan/ep"); - memcpy(fv, &cfg_0, sizeof(cfg_0)); - } - { - FileView fv(L"tmp.dat", 1); - const CfgA& cfg = fv.At(0); - if (cfg_0.bViewWatched != cfg.bViewWatched) - FAIL("bViewWatched is different"); - if (wcscmp(cfg_0.url, cfg.url) != 0) - FAIL("url is not correct"); - } - //DeleteFile(L"tmp.dat"); - } - - // TEST(MigrateCfg) - // { - // FileView fva(L"cfga.dat", 1); - // FileView fvb = FileView::Initialized(L"cfgb.dat", 1); - // fvb->bViewWatched = fva->bViewWatched; - // fvb->bViewTVOriginal = fva->bViewTVOriginal; - // fvb->iSortCol = fva->iSortCol; - // fvb->iFocus = fva->iFocus; - // fvb->heightDlv = fva->heightDlv; - // Wcscpy(fvb->limitScreenwriter, fva->limitScreenwriter); - // Wcscpy(fvb->root, fva->root); - // Wcscpy(fvb->glob, fva->glob); - // Wcscpy(fvb->url, fva->url); - // } - TEST(MigrateDlvDataFromPrologToDisk) { int cEp; @@ -197,50 +140,39 @@ TESTS //DeleteFile(L"tmp.dat"); } - TEST(DownloadDataViaProlog) - { - WcharPtr title, wiki, date, source, hint; - int i = 1053; - /* This is slow. */ - while(Pl("episode_data","fetch_episode_data",++i,&title,&wiki,&date,&source,&hint)) { - extern FileView g_fvElv; - extern FileView g_fvDlv; - - ElvDataA& e = g_fvElv.At(i-1); - Wcscpy(e.title, title); - if (!e.siEp[0]) - Swprintf(e.siEp, L"%d", i); - - DlvDataA& d = g_fvDlv.At(i-1); - Wcscpy(d.wiki, wiki); - Wcscpy(d.date, date); - Wcscpy(d.source, source); - Wcscpy(d.hint, hint); - } - extern CfgA& g_cfg; - g_cfg.cEp = i; - } - - TEST(Fetch) - { - bool bDone = false; - std::thread(WaitFetchData, &bDone).detach(); - } +// TEST(MigrateCfg) +// { +// FileView fva(L"cfga.dat", 1); +// FileView fvb = FileView::Initialized(L"cfgb.dat", 1); +// CfgA* a = fva+0; +// CfgB* b = fvb+0; + +// #define CPY(member) b->member = a->member; +// #define SCPY(member) Wcscpy(b->member, a->member); + +// CPY(bViewWatched); +// CPY(bViewTVOriginal); +// CPY(iSortCol); +// CPY(iFocus); +// CPY(heightDlv); +// SCPY(limitScreenwriter); +// SCPY(root); +// SCPY(glob); +// SCPY(url); + +// #undef CPY +// #undef SCPY +// } }; int RunTests() { const Test tests[] = { StrcpyWithSmallerDestination(), - //EpisodeDataFromWeb(), - //EpisodeDataFromProlog(), //IO(), //MigrateElvDataFromPrologToDisk(), - //SampleConfigurationToDisk(), - //MigrateCfg() //MigrateDlvDataFromPrologToDisk(), - //DownloadDataViaProlog(), - //Fetch(), + //MigrateCfg() }; printf("Results (%llu tests):\n", sizeof(tests)/sizeof(*tests)); -- cgit v1.2.3