From 4b8f00f651153db4a28bff6860bcb5ebb8d6e976 Mon Sep 17 00:00:00 2001 From: "FeRD (Frank Dana)" Date: Tue, 10 Mar 2020 23:34:24 -0400 Subject: [PATCH] ReaderBase_Tests: 100% internal coverage --- tests/ReaderBase_Tests.cpp | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/tests/ReaderBase_Tests.cpp b/tests/ReaderBase_Tests.cpp index e3062bc18..776529d3c 100644 --- a/tests/ReaderBase_Tests.cpp +++ b/tests/ReaderBase_Tests.cpp @@ -49,9 +49,9 @@ TEST(ReaderBase_Derived_Class) std::shared_ptr GetFrame(int64_t number) { std::shared_ptr f(new Frame()); return f; } void Close() { }; void Open() { }; - string Json() const { return NULL; }; + string Json() const { return ""; }; void SetJson(string value) { }; - Json::Value JsonValue() const { return (int) NULL; }; + Json::Value JsonValue() const { return Json::Value("{}"); }; void SetJsonValue(Json::Value root) { }; bool IsOpen() { return true; }; string Name() { return "TestReader"; }; @@ -60,6 +60,23 @@ TEST(ReaderBase_Derived_Class) // Create an instance of the derived class TestReader t1; + // Validate the new class + CHECK_EQUAL("TestReader", t1.Name()); + + t1.Close(); + t1.Open(); + CHECK_EQUAL(true, t1.IsOpen()); + + CHECK_EQUAL(true, t1.GetCache() == NULL); + + t1.SetJson("{ }"); + t1.SetJsonValue(Json::Value("{}")); + CHECK_EQUAL("", t1.Json()); + auto json = t1.JsonValue(); + CHECK_EQUAL(json, Json::Value("{}")); + + auto f = t1.GetFrame(1); + // Check some of the default values of the FileInfo struct on the base class CHECK_EQUAL(false, t1.info.has_audio); CHECK_EQUAL(false, t1.info.has_audio);