diff options
Diffstat (limited to 'c/test.cpp')
-rw-r--r-- | c/test.cpp | 116 |
1 files changed, 24 insertions, 92 deletions
@@ -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)); |