Added regressive unit test for bugfix
This commit is contained in:
parent
7e464510bc
commit
5cbf122dcd
@ -342,6 +342,62 @@ namespace TestHazelnupp
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Tests that parsing a void as int fails
|
||||||
|
TEST_METHOD(Weird_Load_Conversions_VoidFailsAsInt)
|
||||||
|
{
|
||||||
|
// Setup
|
||||||
|
ArgList args({
|
||||||
|
"/my/fake/path/wahoo.out",
|
||||||
|
"--thisisvoid",
|
||||||
|
});
|
||||||
|
|
||||||
|
// Test section: INT
|
||||||
|
Assert::ExpectException<HazelnuppConstraintTypeMissmatch>([args]
|
||||||
|
{
|
||||||
|
Hazelnupp nupp;
|
||||||
|
nupp.SetCrashOnFail(false);
|
||||||
|
|
||||||
|
nupp.RegisterConstraint(
|
||||||
|
"--thisisvoid",
|
||||||
|
ParamConstraint::TypeSafety(DATA_TYPE::INT)
|
||||||
|
);
|
||||||
|
|
||||||
|
// Exercise
|
||||||
|
nupp.Parse(C_Ify(args));
|
||||||
|
|
||||||
|
}, L"Failed with int");
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Tests that parsing a void as float fails
|
||||||
|
TEST_METHOD(Weird_Load_Conversions_VoidFailsAsFloat)
|
||||||
|
{
|
||||||
|
// Setup
|
||||||
|
ArgList args({
|
||||||
|
"/my/fake/path/wahoo.out",
|
||||||
|
"--thisisvoid",
|
||||||
|
});
|
||||||
|
|
||||||
|
// Test section: FLOAT
|
||||||
|
Assert::ExpectException<HazelnuppConstraintTypeMissmatch>([args]
|
||||||
|
{
|
||||||
|
Hazelnupp nupp;
|
||||||
|
nupp.SetCrashOnFail(false);
|
||||||
|
|
||||||
|
nupp.RegisterConstraint(
|
||||||
|
"--thisisvoid",
|
||||||
|
ParamConstraint::TypeSafety(DATA_TYPE::FLOAT)
|
||||||
|
);
|
||||||
|
|
||||||
|
// Exercise
|
||||||
|
nupp.Parse(C_Ify(args));
|
||||||
|
|
||||||
|
}, L"Failed with float");
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Tests that constraints can be cleared invidivually
|
// Tests that constraints can be cleared invidivually
|
||||||
TEST_METHOD(Can_Clear_Constraints_Individually)
|
TEST_METHOD(Can_Clear_Constraints_Individually)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user