Rev | Line | |
---|
[12503] | 1 | using System;
|
---|
| 2 | using System.Collections.Generic;
|
---|
| 3 | using System.Linq;
|
---|
| 4 | using System.Text;
|
---|
| 5 | using System.Diagnostics;
|
---|
| 6 | using System.Windows;
|
---|
| 7 |
|
---|
| 8 | namespace Microsoft.Research.DynamicDataDisplay.Common.Auxiliary
|
---|
| 9 | {
|
---|
| 10 | internal static class DebugVerify
|
---|
| 11 | {
|
---|
| 12 | [Conditional("DEBUG")]
|
---|
| 13 | [DebuggerStepThrough]
|
---|
| 14 | public static void Is(bool condition)
|
---|
| 15 | {
|
---|
| 16 | if (!condition)
|
---|
| 17 | {
|
---|
| 18 | throw new ArgumentException(Strings.Exceptions.AssertionFailed);
|
---|
| 19 | }
|
---|
| 20 | }
|
---|
| 21 |
|
---|
| 22 | [Conditional("DEBUG")]
|
---|
| 23 | [DebuggerStepThrough]
|
---|
| 24 | public static void IsNotNaN(double d)
|
---|
| 25 | {
|
---|
| 26 | DebugVerify.Is(!Double.IsNaN(d));
|
---|
| 27 | }
|
---|
| 28 |
|
---|
| 29 | [Conditional("DEBUG")]
|
---|
| 30 | [DebuggerStepThrough]
|
---|
| 31 | public static void IsNotNaN(Vector vec)
|
---|
| 32 | {
|
---|
| 33 | DebugVerify.IsNotNaN(vec.X);
|
---|
| 34 | DebugVerify.IsNotNaN(vec.Y);
|
---|
| 35 | }
|
---|
| 36 |
|
---|
| 37 | [Conditional("DEBUG")]
|
---|
| 38 | [DebuggerStepThrough]
|
---|
| 39 | public static void IsNotNaN(Point point)
|
---|
| 40 | {
|
---|
| 41 | DebugVerify.IsNotNaN(point.X);
|
---|
| 42 | DebugVerify.IsNotNaN(point.Y);
|
---|
| 43 | }
|
---|
| 44 |
|
---|
| 45 | [Conditional("DEBUG")]
|
---|
| 46 | [DebuggerStepThrough]
|
---|
| 47 | public static void IsFinite(double d)
|
---|
| 48 | {
|
---|
| 49 | DebugVerify.Is(!Double.IsInfinity(d) && !(Double.IsNaN(d)));
|
---|
| 50 | }
|
---|
| 51 |
|
---|
| 52 | [Conditional("DEBUG")]
|
---|
| 53 | [DebuggerStepThrough]
|
---|
| 54 | public static void IsNotNull(object obj)
|
---|
| 55 | {
|
---|
| 56 | DebugVerify.Is(obj != null);
|
---|
| 57 | }
|
---|
| 58 | }
|
---|
| 59 | }
|
---|
Note: See
TracBrowser
for help on using the repository browser.