comparison Assets/Application/Scripts/Debug/DebugCommon.cs @ 5:12f4f937da7f

Add BenchMark
author Kazuma
date Thu, 10 Nov 2016 04:21:19 +0900
parents
children
comparison
equal deleted inserted replaced
4:2878be4487ec 5:12f4f937da7f
1 using System;
2
3 /// <summary>
4 /// Debugクラスに関する汎用関数
5 /// </summary>
6 public static class DebugCommon
7 {
8 /// <summary>
9 /// 条件をチェックし、その条件が true の場合は例外を投げます
10 /// </summary>
11 /// <param name="condition">評価する条件式</param>
12 public static void Assert(bool condition)
13 {
14 if (condition)
15 {
16 throw new Exception();
17 }
18 }
19
20 /// <summary>
21 /// 条件をチェックし、その条件が true の場合は例外を投げます
22 /// </summary>
23 /// <param name="condition">評価する条件式</param>
24 /// <param name="message">送信するメッセージ</param>
25 public static void Assert(bool condition, string message)
26 {
27 if (condition)
28 {
29 throw new Exception(message);
30 }
31 }
32
33 /// <summary>
34 /// 条件をチェックし、その条件が true の場合は例外を投げます
35 /// </summary>
36 /// <param name="condition">評価する条件式</param>
37 /// <param name="getMessage">送信するメッセージを返す関数</param>
38 public static void Assert(bool condition, Func<string> getMessage)
39 {
40 if (condition)
41 {
42 throw new Exception(getMessage());
43 }
44 }
45 }