Free cookie consent management tool by TermsFeed Policy Generator

source: branches/HeuristicLab.Problems.GrammaticalOptimization/DynamicDataDisplay/Common/Auxiliary/DebugVerify.cs @ 13808

Last change on this file since 13808 was 12503, checked in by aballeit, 9 years ago

#2283 added GUI and charts; fixed MCTS

File size: 1.2 KB
Line 
1using System;
2using System.Collections.Generic;
3using System.Linq;
4using System.Text;
5using System.Diagnostics;
6using System.Windows;
7
8namespace 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.