diff 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
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/test_util.jl	Fri Jul 02 14:02:45 2021 +0200
@@ -0,0 +1,8 @@
+function is_type_stable(f,args...)
+    type_stable = true
+    try @inferred f(args...)
+    catch
+        type_stable = false
+    end
+    return type_stable
+end