about summary refs log tree commit diff
path: root/sourcecodes/bnt-master/KPMtools/assertBNT.m
diff options
context:
space:
mode:
Diffstat (limited to 'sourcecodes/bnt-master/KPMtools/assertBNT.m')
-rw-r--r--sourcecodes/bnt-master/KPMtools/assertBNT.m10
1 files changed, 10 insertions, 0 deletions
diff --git a/sourcecodes/bnt-master/KPMtools/assertBNT.m b/sourcecodes/bnt-master/KPMtools/assertBNT.m
new file mode 100644
index 00000000..2d0cf960
--- /dev/null
+++ b/sourcecodes/bnt-master/KPMtools/assertBNT.m
@@ -0,0 +1,10 @@
+function assertBNT(pred, str)
+% ASSERT Raise an error if the predicate is not true.
+% assert(pred, string)
+
+if nargin<2, str = ''; end
+
+if ~pred
+  s = sprintf('assertion violated: %s', str);
+  error(s);
+end