aboutsummaryrefslogtreecommitdiff
path: root/c/test.cpp
diff options
context:
space:
mode:
authorJohn Ankarström <john@ankarstrom.se>2022-08-15 22:26:03 +0200
committerJohn Ankarström <john@ankarstrom.se>2022-08-15 22:26:03 +0200
commitafd245c205e2787e54cb7e2fd34de617eeceed25 (patch)
treecdce14213a376a0e44c8a4906a35b009e65eef7a /c/test.cpp
parent246fd1369dce903dad48730478bebbe9733ac88e (diff)
downloadEpisodeBrowser-afd245c205e2787e54cb7e2fd34de617eeceed25.tar.gz
Add basic serialization functions for ElvData.
Diffstat (limited to 'c/test.cpp')
-rw-r--r--c/test.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/c/test.cpp b/c/test.cpp
index 67a32c9..1fc7e3b 100644
--- a/c/test.cpp
+++ b/c/test.cpp
@@ -46,6 +46,31 @@ TESTS
if (wcscmp(d.date, L"March 11, 1996") != 0)
FAIL("date is not correct");
}
+
+ TEST(Serialization)
+ {
+ ElvData e1;
+ FromProlog(6, e1);
+
+ unsigned char buf[CB_SERIALIZE_ELVDATA];
+ Serialize(e1, buf);
+
+ ElvData e2;
+ if (!Unserialize(e2, buf))
+ FAIL("invalid serialization version");
+ if (e1.rating != e2.rating)
+ FAIL("rating is different");
+ if (e1.bWatched != e2.bWatched)
+ FAIL("bWatched is different");
+ if (e1.bTVOriginal != e2.bTVOriginal)
+ FAIL("bTVOriginal is different");
+ if (wcscmp(e1.sRating, e2.sRating) != 0)
+ FAIL("sRating is different");
+ if (wcscmp(e1.siEp, e2.siEp) != 0)
+ FAIL("siEp is different");
+ if (wcscmp(e1.title, e2.title) != 0)
+ FAIL("title is different");
+ }
};
int RunTests()
@@ -54,6 +79,7 @@ int RunTests()
StrcpyWithSmallerDestination{},
//EpisodeDataFromWeb{},
EpisodeDataFromProlog{},
+ Serialization{},
};
printf("Results (%llu tests):\n", sizeof(tests)/sizeof(*tests));