/Main/src/DynamicDataDisplay/Common/Auxiliary/DebugVerify.cs
C# | 59 lines | 53 code | 6 blank | 0 comment | 3 complexity | d4405a1d4b8d4c522399f3a1c14684d6 MD5 | raw file
Possible License(s): CC-BY-SA-3.0
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Diagnostics;
- using System.Windows;
-
- namespace Microsoft.Research.DynamicDataDisplay.Common.Auxiliary
- {
- internal static class DebugVerify
- {
- [Conditional("DEBUG")]
- [DebuggerStepThrough]
- public static void Is(bool condition)
- {
- if (!condition)
- {
- throw new ArgumentException(Strings.Exceptions.AssertionFailed);
- }
- }
-
- [Conditional("DEBUG")]
- [DebuggerStepThrough]
- public static void IsNotNaN(double d)
- {
- DebugVerify.Is(!Double.IsNaN(d));
- }
-
- [Conditional("DEBUG")]
- [DebuggerStepThrough]
- public static void IsNotNaN(Vector vec)
- {
- DebugVerify.IsNotNaN(vec.X);
- DebugVerify.IsNotNaN(vec.Y);
- }
-
- [Conditional("DEBUG")]
- [DebuggerStepThrough]
- public static void IsNotNaN(Point point)
- {
- DebugVerify.IsNotNaN(point.X);
- DebugVerify.IsNotNaN(point.Y);
- }
-
- [Conditional("DEBUG")]
- [DebuggerStepThrough]
- public static void IsFinite(double d)
- {
- DebugVerify.Is(!Double.IsInfinity(d) && !(Double.IsNaN(d)));
- }
-
- [Conditional("DEBUG")]
- [DebuggerStepThrough]
- public static void IsNotNull(object obj)
- {
- DebugVerify.Is(obj != null);
- }
- }
- }