From b87833b701a02fa960fab3fdb40d0b2d2c49a80e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20Ankarstr=C3=B6m?= Date: Mon, 22 Aug 2022 03:23:12 +0200 Subject: Change initialization style. Because I don't want to have to remember what classes have initializer_list overloads. --- c/test.cpp | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) (limited to 'c/test.cpp') diff --git a/c/test.cpp b/c/test.cpp index 7d6b3ed..a649f23 100644 --- a/c/test.cpp +++ b/c/test.cpp @@ -64,7 +64,7 @@ TESTS /* Write two ElvDataA structs to disk. */ { - FileView fv{L"tmp.dat", 2}; + FileView fv(L"tmp.dat", 2); memcpy(fv+0, &e1_0, sizeof(e1_0)); memcpy(fv+1, &e2_0, sizeof(e2_0)); } @@ -72,7 +72,7 @@ TESTS /* Read first ElvDataA struct from disk using * ElvDataA-typed FileView. */ { - FileView fv{L"tmp.dat", 2}; + FileView fv(L"tmp.dat", 2); const ElvDataA& e1 = *fv; if (e1.version != 'a') FAIL("version is different"); @@ -93,7 +93,7 @@ TESTS /* Read second ElvDataA struct from disk using * unsigned char-typed FileView. */ { - FileView fv{L"tmp.dat", 2*sizeof(ElvDataA)}; + FileView fv(L"tmp.dat", 2*sizeof(ElvDataA)); ElvDataA& e2 = *reinterpret_cast(&fv.At(sizeof(ElvDataA))); if (e2_0.rating != e2.rating) FAIL("rating is different (%d/%d)", e2_0.rating, e2.rating); @@ -118,7 +118,7 @@ TESTS return; { - FileView fv{L"tmp.dat", g_cfg.cEp+128u}; + FileView fv(L"tmp.dat", g_cfg.cEp+128u); ElvDataA* p = fv; for (int iEp = 1; iEp <= cEp; iEp++) { @@ -129,7 +129,7 @@ TESTS } } { - FileView fv{L"tmp.dat", g_cfg.cEp+128u}; + 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"); @@ -141,12 +141,12 @@ TESTS { CfgA cfg_0; { - FileView fv{L"tmp.dat", 1}; + 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}; + FileView fv(L"tmp.dat", 1); const CfgA& cfg = fv.At(0); if (cfg_0.bViewWatched != cfg.bViewWatched) FAIL("bViewWatched is different"); @@ -158,7 +158,7 @@ TESTS // TEST(MigrateCfg) // { - // FileView fva{L"cfga.dat", 1}; + // FileView fva(L"cfga.dat", 1); // FileView fvb = FileView::Initialized(L"cfgb.dat", 1); // fvb->bViewWatched = fva->bViewWatched; // fvb->bViewTVOriginal = fva->bViewTVOriginal; @@ -178,7 +178,7 @@ TESTS return; { - FileView fv{L"tmp.dat", g_cfg.cEp+128u}; + FileView fv(L"tmp.dat", g_cfg.cEp+128u); DlvDataA* p = fv; for (int iEp = 1; iEp <= cEp; iEp++) { @@ -189,7 +189,7 @@ TESTS } } { - FileView fv{L"tmp.dat", g_cfg.cEp+128u}; + 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"); @@ -224,23 +224,23 @@ TESTS TEST(Fetch) { bool bDone = false; - std::thread{WaitFetchData, &bDone}.detach(); + std::thread(WaitFetchData, &bDone).detach(); } }; int RunTests() { const Test tests[] = { - StrcpyWithSmallerDestination{}, - //EpisodeDataFromWeb{}, - //EpisodeDataFromProlog{}, - //IO{}, - //MigrateElvDataFromPrologToDisk{}, - //SampleConfigurationToDisk{}, - //MigrateCfg{} - //MigrateDlvDataFromPrologToDisk{}, - //DownloadDataViaProlog{}, - //Fetch{}, + StrcpyWithSmallerDestination(), + //EpisodeDataFromWeb(), + //EpisodeDataFromProlog(), + //IO(), + //MigrateElvDataFromPrologToDisk(), + //SampleConfigurationToDisk(), + //MigrateCfg() + //MigrateDlvDataFromPrologToDisk(), + //DownloadDataViaProlog(), + //Fetch(), }; printf("Results (%llu tests):\n", sizeof(tests)/sizeof(*tests)); -- cgit v1.2.3