aboutsummaryrefslogtreecommitdiff
path: root/c/test.cpp
diff options
context:
space:
mode:
authorJohn Ankarström <john@ankarstrom.se>2022-08-22 03:23:12 +0200
committerJohn Ankarström <john@ankarstrom.se>2022-08-22 03:23:12 +0200
commitb87833b701a02fa960fab3fdb40d0b2d2c49a80e (patch)
tree521f653729196b42c3af066c82a4b5599d84e691 /c/test.cpp
parentd7bb04a09c7f04b0c3a8580d6a9ccd6313656fcf (diff)
downloadEpisodeBrowser-b87833b701a02fa960fab3fdb40d0b2d2c49a80e.tar.gz
Change initialization style.
Because I don't want to have to remember what classes have initializer_list overloads.
Diffstat (limited to 'c/test.cpp')
-rw-r--r--c/test.cpp42
1 files changed, 21 insertions, 21 deletions
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<ElvDataA> fv{L"tmp.dat", 2};
+ FileView<ElvDataA> 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<ElvDataA> fv{L"tmp.dat", 2};
+ FileView<ElvDataA> 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<unsigned char> fv{L"tmp.dat", 2*sizeof(ElvDataA)};
+ FileView<unsigned char> fv(L"tmp.dat", 2*sizeof(ElvDataA));
ElvDataA& e2 = *reinterpret_cast<ElvDataA*>(&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<ElvDataA> fv{L"tmp.dat", g_cfg.cEp+128u};
+ FileView<ElvDataA> fv(L"tmp.dat", g_cfg.cEp+128u);
ElvDataA* p = fv;
for (int iEp = 1; iEp <= cEp; iEp++) {
@@ -129,7 +129,7 @@ TESTS
}
}
{
- FileView<ElvDataA> fv{L"tmp.dat", g_cfg.cEp+128u};
+ FileView<ElvDataA> 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<CfgA> fv{L"tmp.dat", 1};
+ 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};
+ FileView<CfgA> 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<CfgA> fva{L"cfga.dat", 1};
+ // 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;
@@ -178,7 +178,7 @@ TESTS
return;
{
- FileView<DlvDataA> fv{L"tmp.dat", g_cfg.cEp+128u};
+ FileView<DlvDataA> fv(L"tmp.dat", g_cfg.cEp+128u);
DlvDataA* p = fv;
for (int iEp = 1; iEp <= cEp; iEp++) {
@@ -189,7 +189,7 @@ TESTS
}
}
{
- FileView<DlvDataA> fv{L"tmp.dat", g_cfg.cEp+128u};
+ FileView<DlvDataA> 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));