You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Adding the ability to do property based testing to mgunit would help find more bugs.
To do property based tests, you would write methods that take parameters and don't start with "test." Then the actual test methods would call a routine, mgunit_proptest, that calls the test method with the given keywords.
For example, to test the routine mg_n_smallest:
function mg_n_smallest_ut::check_size, array=array, n=n
compile_opt strictarr
result = mg_n_smallest(arr, n)
assert, n_elements(result) eq n
return, 1
end
function mg_n_smallest_ut::test_size
compile_opt strictarr
mgunit_proptest, self, 'check_size', $
array=mgunit_array(mgunit_float()), $
n=mgunit_long(min_value=0)
return, 1
end
pro mg_n_smallest_ut__define
compile_opt strictarr
define = { mg_n_smallest_ut, inherits MGutLibTestCase }
end
Other features:
mgunit should write an explicit unit test when a property based test fails.
The text was updated successfully, but these errors were encountered:
Adding the ability to do property based testing to mgunit would help find more bugs.
To do property based tests, you would write methods that take parameters and don't start with "test." Then the actual test methods would call a routine,
mgunit_proptest
, that calls the test method with the given keywords.For example, to test the routine
mg_n_smallest
:Other features:
mgunit
should write an explicit unit test when a property based test fails.The text was updated successfully, but these errors were encountered: