From 8692180ca604e81cdaf2979fc8cc8f2e9552f98b Mon Sep 17 00:00:00 2001 From: Leonetienne Date: Thu, 3 Jun 2021 00:44:40 +0200 Subject: [PATCH] Added more edgecase tests --- Test_Hazelnupp/Basics.cpp | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/Test_Hazelnupp/Basics.cpp b/Test_Hazelnupp/Basics.cpp index 419f0e3..4eec2e7 100644 --- a/Test_Hazelnupp/Basics.cpp +++ b/Test_Hazelnupp/Basics.cpp @@ -48,6 +48,45 @@ namespace TestHazelnupp return; } + // Edgecase test: We begin with an actual value, instead of an argument. + TEST_METHOD(Weird_Case_1) + { + // Setup + ArgList args({ + "/my/fake/path/wahoo.out", + "dummy" + }); + + // Exercise + Hazelnupp nupp(C_Ify(args)); + nupp.SetCrashOnFail(false); + + // Verify (no exception) + + return; + } + + // Edgecase test: We begin with first an actual value, and then an argument. + TEST_METHOD(Weird_Case_2) + { + // Setup + ArgList args({ + "/my/fake/path/wahoo.out", + "dummy", + "--dummy" + }); + + // Exercise + Hazelnupp nupp(C_Ify(args)); + nupp.SetCrashOnFail(false); + + // Verify + Assert::IsTrue(nupp.HasParam("--dummy"), L"Failed has-param"); + Assert::IsTrue(nupp["--dummy"].GetDataType() == DATA_TYPE::VOID, L"Failed type"); + + return; + } + // Tests keys exist after parsing TEST_METHOD(KeysExist) {