aboutsummaryrefslogtreecommitdiff
path: root/c/test.cpp
diff options
context:
space:
mode:
authorJohn Ankarström <john@ankarstrom.se>2022-08-22 13:00:06 +0200
committerJohn Ankarström <john@ankarstrom.se>2022-08-22 13:00:06 +0200
commitee1eafe1ed12c2c46ed31ad560daeae11ab1e027 (patch)
treec12b50948c35d106f989f45028f1b560073f4107 /c/test.cpp
parentb87833b701a02fa960fab3fdb40d0b2d2c49a80e (diff)
downloadEpisodeBrowser-ee1eafe1ed12c2c46ed31ad560daeae11ab1e027.tar.gz
Clean up tests.
Diffstat (limited to 'c/test.cpp')
-rw-r--r--c/test.cpp116
1 files changed, 24 insertions, 92 deletions
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<CfgA> 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<CfgA> 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<CfgA> fva(L"cfga.dat", 1);
- // FileView<CfgB> fvb = FileView<CfgB>::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<ElvDataA> g_fvElv;
- extern FileView<DlvDataA> 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<CfgA> fva(L"cfga.dat", 1);
+// FileView<CfgB> fvb = FileView<CfgB>::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));