annotate test/test_util.jl @ 760:e7176fb09e98 test/type_stability

Add utility function for testing type stability using the @inferred macro to allow for tests failing, rather than producing an error.
author Vidar Stiernström <vidar.stiernstrom@it.uu.se>
date Fri, 02 Jul 2021 14:02:45 +0200
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
760
e7176fb09e98 Add utility function for testing type stability using the @inferred macro to allow for tests failing, rather than producing an error.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff changeset
1 function is_type_stable(f,args...)
e7176fb09e98 Add utility function for testing type stability using the @inferred macro to allow for tests failing, rather than producing an error.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff changeset
2 type_stable = true
e7176fb09e98 Add utility function for testing type stability using the @inferred macro to allow for tests failing, rather than producing an error.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff changeset
3 try @inferred f(args...)
e7176fb09e98 Add utility function for testing type stability using the @inferred macro to allow for tests failing, rather than producing an error.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff changeset
4 catch
e7176fb09e98 Add utility function for testing type stability using the @inferred macro to allow for tests failing, rather than producing an error.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff changeset
5 type_stable = false
e7176fb09e98 Add utility function for testing type stability using the @inferred macro to allow for tests failing, rather than producing an error.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff changeset
6 end
e7176fb09e98 Add utility function for testing type stability using the @inferred macro to allow for tests failing, rather than producing an error.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff changeset
7 return type_stable
e7176fb09e98 Add utility function for testing type stability using the @inferred macro to allow for tests failing, rather than producing an error.
Vidar Stiernström <vidar.stiernstrom@it.uu.se>
parents:
diff changeset
8 end